You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
639 B

' Visual Basic version of a Prime Number Finder
Imports System
Imports Math
Module Prime
Sub Main(ByVal CmdArgs() As String)
Dim cnt As Long, max As Long
Dim test As Double, isPrime As Byte, i as Long
If CmdArgs.Length < 1 then
Console.WriteLine("Usage: primesvb [Max Num]")
max = Convert.ToInt32(CmdArgs(0))
End If
For cnt = 3 to max Step +2
test = Math.Sqrt(cnt)
isPrime = 1
For i = 3 to test Step +2
If (cnt mod i) = 0 then
isPrime = 0
Exit For
End If
If isPrime <> 0 Then
End If
End Sub
End Module