Detecting Prime Numbers.
Detecting Prime Numbers.
API Declarations
Put a Command Button called command1 on the form and a text box called text1
Put the amount of numbers you want it to count up to in text1. Click on command1 and the program will calculate all the prime numbers up to that number. It will output in a file called primenumbers.txt in the same directory as the program is
Rate Detecting Prime Numbers.
(2(2 Vote))
b = ""
For i = 1 To Text1.Text
n = 1
For m = 2 To i
If m = i Then
If n = 1 Then
b = b & i & ", "
GoTo restart1
End If
End If
If i / m = Round(i / m, 0) Then
n = 0
End If
restart1:
Next
Next
Open App.Path & "\primenumbers.txt" For Output As #1
Print #1, b
Close #1
End Sub
Detecting Prime Numbers. Comments
No comments yet — be the first to post one!
Post a Comment