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 While Not EOF(1) ans = 0 Input #1, n, d For i = 2 To n If n Mod i = 0 Then If i Mod d = 0 Then ans = ans + 1 End If Next Print #2, ans Loop Close Close End End Sub
Dim num1, num2, ans 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, num1, num2 For i = 1 To num1 If num1 Mod i = 0 Then If i Mod num2 = 0 Then ans = ans + 1 End If Next Print #2, ans ans = 0 Loop Until EOF(1) 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 Until EOF(1) t = 0 Input #1, a, b For i = 1 To a If a Mod i = 0 And i Mod b = 0 Then t = t + 1 Next Print #2, t 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 While Not EOF(1) Input #1, n, d For i = 2 To n If n Mod i = 0 Then If i Mod d = 0 Then ans = ans + 1 End If Next Print #2, ans 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 While Not EOF(1)
ans = 0
Input #1, n, d
For i = 2 To n
If n Mod i = 0 Then
If i Mod d = 0 Then ans = ans + 1
End If
Next
Print #2, ans
Loop
Close
Close
End
End Sub
Dim num1, num2, ans 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, num1, num2
For i = 1 To num1
If num1 Mod i = 0 Then
If i Mod num2 = 0 Then ans = ans + 1
End If
Next
Print #2, ans
ans = 0
Loop Until EOF(1)
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 Until EOF(1)
t = 0
Input #1, a, b
For i = 1 To a
If a Mod i = 0 And i Mod b = 0 Then t = t + 1
Next
Print #2, t
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 While Not EOF(1)
Input #1, n, d
For i = 2 To n
If n Mod i = 0 Then
If i Mod d = 0 Then ans = ans + 1
End If
Next
Print #2, ans
Close
Close
End
End Sub