| File:http://libg.org/code/sample.vb | Help |
'From: http://en.wikipedia.org/wiki/Visual_Basic
Private Sub DisplayPrimeNumbers()
Dim Num As Long
Dim NN As Long
Dim IsPrime As Boolean
For Num = 2 To 100
IsPrime = True
For NN = 2 To Int(Num / 2)
If Num Mod NN = 0 Then
IsPrime = False
Exit For
End If
Next
If IsPrime Then
MsgBox(CStr(Num) + " is a prime number!")
End If
Next
End Sub