用Do...Loop循环语句,求m和n的最大公约数,以下是程序代码,Private Sub Command1_Click()Dim m As Long,n As Long,t As Longm = Val(Text1.Text)n = Val(Text2.Text)If m < n Thent = m:m = n:n = tEnd IfDor = m Mod nm = nn = rLoop While r 0Labe
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 10:36:05
用Do...Loop循环语句,求m和n的最大公约数,以下是程序代码,Private Sub Command1_Click()Dim m As Long,n As Long,t As Longm = Val(Text1.Text)n = Val(Text2.Text)If m < n Thent = m:m = n:n = tEnd IfDor = m Mod nm = nn = rLoop While r 0Labe
用Do...Loop循环语句,求m和n的最大公约数,以下是程序代码,
Private Sub Command1_Click()
Dim m As Long,n As Long,t As Long
m = Val(Text1.Text)
n = Val(Text2.Text)
If m < n Then
t = m:m = n:n = t
End If
Do
r = m Mod n
m = n
n = r
Loop While r 0
Label1.Caption = m
End Sub
用Do...Loop循环语句,求m和n的最大公约数,以下是程序代码,Private Sub Command1_Click()Dim m As Long,n As Long,t As Longm = Val(Text1.Text)n = Val(Text2.Text)If m < n Thent = m:m = n:n = tEnd IfDor = m Mod nm = nn = rLoop While r 0Labe
Private Sub Command1_Click()
Dim m As Long, n As Long, t As Long
m = Val(Text1.Text)
n = Val(Text2.Text)'两个文本框中分别输入整数m和n
If m < n Then '如果m