VB的问题,在线等答案,急!

2024-12-02 22:10:50
推荐回答(1个)
回答1:

Private Sub Form_Click()
Dim a%, b%, num1%, num2%, temp
num1 = InputBox("请输入一个正整数")
num2 = InputBox("请输入一个正整数")

If num1 < num2 Then '填空1
temp = num1: num1 = num2: num2 = temp
End If
a = num1
b = num2

While temp <> 0 '填空2
temp = a Mod b
a = b
b = temp '填空3
Wend
Print "最大公因数为:"; a
Print "最小公倍数为:"; num1 * num2 / a
End Sub