Dim max, min As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2
Do Input #1, max, min If max = min And min = 0 Then Exit Do If max < min Then temp = max: max = min: min = temp Do If min = 0 Then Print #2, max: Exit Do temp = min min = max - (min * (max \ min)) max = temp Loop Loop Close #2 Close #1 End End Sub
Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Do Input #1, a, b If a = 0 And b = 0 Then Exit Do Do Until a = 0 Or b = 0 If a > b Then a = a Mod b Else b = b Mod a End If Loop If a = 0 Then Print #2, b Else Print #2, a Loop Close Close End End Sub
Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Do Input #1, x Input #1, y If x = 0 Or y = 0 Then Exit Do If x > y Then a = x: x = y: y = a For i = x To 2 Step -1 If x Mod i = 0 And y Mod i = 0 Then Exit For Next Print #2, i Loop Close #2 Close #1 End End Sub
Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Do Input #1, x Input #1, y If x = 0 Or y = 0 Then Exit Do Do If x = y Or y = 0 Then Exit Do If x > y Then a = x: x = y: y = a y = y Mod x Loop Print #2, x Loop Close #2 Close #1 End End Sub
Dim max, min As Integer
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Do
Input #1, max, min
If max = min And min = 0 Then Exit Do
If max < min Then temp = max: max = min: min = temp
Do
If min = 0 Then Print #2, max: Exit Do
temp = min
min = max - (min * (max \ min))
max = temp
Loop
Loop
Close #2
Close #1
End
End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Do
Input #1, a, b
If a = 0 And b = 0 Then Exit Do
Do Until a = 0 Or b = 0
If a > b Then
a = a Mod b
Else
b = b Mod a
End If
Loop
If a = 0 Then Print #2, b Else Print #2, a
Loop
Close
Close
End
End Sub
作者已經移除這則留言。
回覆刪除作者已經移除這則留言。
回覆刪除Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Do
Input #1, x
Input #1, y
If x = 0 Or y = 0 Then Exit Do
If x > y Then a = x: x = y: y = a
For i = x To 2 Step -1
If x Mod i = 0 And y Mod i = 0 Then Exit For
Next
Print #2, i
Loop
Close #2
Close #1
End
End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Do
Input #1, x
Input #1, y
If x = 0 Or y = 0 Then Exit Do
Do
If x = y Or y = 0 Then Exit Do
If x > y Then a = x: x = y: y = a
y = y Mod x
Loop
Print #2, x
Loop
Close #2
Close #1
End
End Sub