Option Explicit
Private Sub Command1_Click() Dim A As Integer, B As Integer, C As Integer Dim i As Integer
A = Val(Text1.Text) B = Val(Text2.Text) If A > B Then C = A A = B B = C Else C = A End If Do While True If C Mod A = 0 And C Mod B = 0 Then Label1.Caption = C Exit Do Else C = C + 1 End If Loop
End Sub
谢谢
顶
数学里的计算方法
Option Explicit
Private Sub Command1_Click() Dim A As Integer, B As Integer, C As Integer Dim i As Integer
A = Val(Text1.Text) B = Val(Text2.Text) i = 2 C = 1 Do While A >= i And B >= i If A Mod i = 0 And B Mod i = 0 Then C = C * i A = A / i B = B / i i = 2 Else i = i + 1 End If Loop Label1.Caption = C * A * B
End Sub