Private Sub Command1_Click()
Dim n As Integer, ans As Integer
n = 5
Dim x(1 To 5) As Integer
x(1) = -30: x(2) = 26: x(3) = -18: x(4) = 60: x(5) = 22
ans = 60
For i = 1 To n
If x(i) < 0 Then x(i) = -x(i)
ans = ans + gcd(ans, x(i))
Next i
Text1.Text = Str(ans)
End Sub
Function gcd(a As Integer, b As Integer)
If b = 0 Then
gcd = a
Else
gcd = gcd(b, a Mod b)
End If
End Function
执行该程序段后,Text1. Text中显示的值为( )