Check whether the input number is prime or not
Module Module1
Sub Main()
'program to check whether the input number is a prime number or not
'decalring the variables
Dim entry, count, index As Integer
Console.WriteLine("Enter the number to check prime or not")
entry = Console.ReadLine()
For index = 1 To entry
If entry Mod index = 0 Then
count = count + 1
End If
Next
If count = 2 Then
Console.WriteLine(entry & " is a prime number")
Else
Console.WriteLine(entry & " is not a prime number")
End If
Console.ReadKey()
End Sub
End Module
Comments
Post a Comment