IsPrimeLong




Private Sub Form_Load()
s:
Form1.Visible = False
Dim k As Integer 'You need To declere this as int
Dim n As Boolean 'if number is prime Then n = True
n = True
k = InputBox("Give a number", "Number") ' number input
For i = 2 To k 'this algoritm checks numbers for prime
For r = 2 To k
o = i * r
If o = k Then
n = False
End If
Next r
Next i

If n = True Then
MsgBox "prime", , "prime'"
Else
MsgBox "not prime", , "not prime"
End If

a = MsgBox("do you want To continue", vbYesNo, "continue")
If a = vbYes Then
Goto s
Else
End
End If
End Sub










( isprimelong.html )- by Paolo Puglisi - Modifica del 17/12/2023