最大公约数
m = InputBox("输入第一个自然数")
n = InputBox("输入第二个自然数")
If m < n Then t = m: m = n: n = t
r = m Mod n
Do While (r 0)
m = n
n = r
r = m Mod n
Loop
End if
MsgBox ("最大公约数为" & n)
最小公倍数
Dim a%, b%, m%
a = InputBox("第一个数")
b = InputBox("第二个数")
For m = b To 1 Step -1
If a Mod m = 0 And b Mod m = 0 Then
Exit For
End If
Next
m = a * b / m
MsgBox "最小公倍数是" + CStr(m)