Dim haveprint As Boolean Private Sub Form_Load() Me.Hide Open App.Path & "\out3.txt" For Output As #2 For i = 1000 To 9999 For ii = 1 To 4 ans = ans + Val(Mid(i, ii, 1)) ^ 3 Next If ans = i Then Print #2, ans: haveprint = True ans = 0 Next If haveprint = False Then Print #2, "0000" Close #2 End End Sub
Dim b As Boolean Private Sub Form_Load() Me.Hide Open App.Path & "\out3.txt" For Output As #1 For i = 1000 To 9999 b = False For j = 1 To 4 x = x + (Val(Mid(i, j, 1))) ^ 3 Next If x = i Then b = True: Print #1, i Next If b = False Then Print #1, "0000" Close End End Sub
Dim haveprint As Boolean
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\out3.txt" For Output As #2
For i = 1000 To 9999
For ii = 1 To 4
ans = ans + Val(Mid(i, ii, 1)) ^ 3
Next
If ans = i Then Print #2, ans: haveprint = True
ans = 0
Next
If haveprint = False Then Print #2, "0000"
Close #2
End
End Sub
Dim b As Boolean
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\out3.txt" For Output As #1
For i = 1000 To 9999
b = False
For j = 1 To 4
x = x + (Val(Mid(i, j, 1))) ^ 3
Next
If x = i Then b = True: Print #1, i
Next
If b = False Then Print #1, "0000"
Close
End
End Sub