Dim notwant As Boolean Private Sub Form_Load() Me.Hide Open App.Path & "\out.txt" For Output As #1 For i = 32767 To 1 Step -1 For ii = 2 To i - 1 If i Mod ii = 0 Then notwant = True: Exit For Next If notwant = False Then Print #1, i: mycount = mycount + 1 notwant = False If mycount = 2 Then Exit For Next
Dim tof As Boolean Private Sub Form_Load() Me.Hide 'Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 s = 0 For i = 32767 To 1 Step -1 tof = False For j = 2 To (i - 1) / 2 If i Mod j = 0 Then tof = True: Exit For Next j If tof = False Then Print #2, i: s = s + 1 If s = 2 Then End Next i Close #2 'Close #1 End End Sub
Dim notwant As Boolean
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\out.txt" For Output As #1
For i = 32767 To 1 Step -1
For ii = 2 To i - 1
If i Mod ii = 0 Then notwant = True: Exit For
Next
If notwant = False Then Print #1, i: mycount = mycount + 1
notwant = False
If mycount = 2 Then Exit For
Next
Close #1
End
End Sub
作者已經移除這則留言。
回覆刪除Dim tof As Boolean
回覆刪除Private Sub Form_Load()
Me.Hide
'Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
s = 0
For i = 32767 To 1 Step -1
tof = False
For j = 2 To (i - 1) / 2
If i Mod j = 0 Then tof = True: Exit For
Next j
If tof = False Then Print #2, i: s = s + 1
If s = 2 Then End
Next i
Close #2
'Close #1
End
End Sub