Dim num, 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 Input #1, num For i = 2 To num For ii = 1 To i - 1 If i Mod ii = 0 Then ans = ans + ii Next If ans = i Then Print #2, i ans = 0 Next 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 Input #1, x For i = 1 To x s = 0 For j = 1 To i - 1 If i Mod j = 0 Then s = s + j Next If s = i Then Print #2, i Next Close Close End End Sub
Dim num 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 Input #1, n For i = 4 To n For j = 2 To i - 1 If i Mod j = 0 Then num = num + j Next If num + 1 = i Then Print #2, i num = 0 Next Close #2 Close #1 End End Sub
Dim num, 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
Input #1, num
For i = 2 To num
For ii = 1 To i - 1
If i Mod ii = 0 Then ans = ans + ii
Next
If ans = i Then Print #2, i
ans = 0
Next
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
Input #1, x
For i = 1 To x
s = 0
For j = 1 To i - 1
If i Mod j = 0 Then s = s + j
Next
If s = i Then Print #2, i
Next
Close
Close
End
End Sub
Dim num 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
Input #1, n
For i = 4 To n
For j = 2 To i - 1
If i Mod j = 0 Then num = num + j
Next
If num + 1 = i Then Print #2, i
num = 0
Next
Close #2
Close #1
End
End Sub