展开全部
Private Sub command1_click()
Dim m As Integer, n As Integer
Dim a As Integer, b As Integer
Dim r As Integer
m = InputBox("输入m")
n = InputBox("输入n")
a = m
b = n
Do
r = Abs(m - n)
m = n
n = r
Loop While m <> n
Print a; "和"; b; "最大公约数是"; r
Print a; "和"; b; "最小公倍数是"; a * b / r
End Sub
Dim m As Integer, n As Integer
Dim a As Integer, b As Integer
Dim r As Integer
m = InputBox("输入m")
n = InputBox("输入n")
a = m
b = n
Do
r = Abs(m - n)
m = n
n = r
Loop While m <> n
Print a; "和"; b; "最大公约数是"; r
Print a; "和"; b; "最小公倍数是"; a * b / r
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询