Private Sub Command1_Click()
Dim a%, b%, c%
a = Val(Text1.Text)
b = Val(Text2.Text)
c = GCD(a, b)
Picture1.Print "最大公约数为" & c
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Function GCD%(m%, n%)
Dim d%
If m = 0 Or n = 0 Then
d = MsgBox("输入不符要求", 64)
If m < n Then
temp = n: n = m: m = temp
If m Mod n = 0 Then
d = n
Else
d = GCD(n, m Mod n)
GCD = d
End If
End If
End If
End Function