第1个回答 2015-10-08
把n1 = GCD(m1, n1)这条语句改成: GCD(m1, n1)
Private Sub Command1_Click()
Dim Ar() As Long
Dim n%, i%, n1&, m1&
n = Val(InputBox("求几个数的最大公约数?"))
If n < 2 Or n > 20 Then Exit Sub
ReDim Ar(n)
For i = 1 To n
Ar(i) = Val(InputBox("输入第" & i & "个数:"))
If Ar(i) <= 0 Then
Picture1.Cls
Exit Sub
End If
Picture1.Print Ar(i);
If Picture1.CurrentX > Picture1.Width * 0.8 Then Picture1.Print
Next i
Picture1.Print
n1 = Ar(1)
For i = 2 To n
m1 = Ar(i)
GCD(m1, n1) '这里改一下即可
If n1 = 1 Then
Exit For
End If
Next i
Picture1.Print "以上"; n; "个数的最大公约数是:"; n1
End Sub