Private Sub Command1_Click() Dim m, n, r, s, b As Long m = Val(Text1.Text) n = Val(Text2.Text) r = m Mod n s = m * n Do While r <> 0 m = n n = r r = m Mod n Loop Label1.Caption = "最大公约数是" + Str(n) + ",最小公倍数是" + Str(s / n) End Sub
时间: 2024-10-29 08:18:16