用Do...Loop循环语句,求m和n的最大公约数,以下是程序代码,
问题描述:
用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 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
答
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