i need a prime numbers in console application in vb.net
prime numbersi need a prime numbers examples
Page 1 of 1
1 Replies - 2228 Views - Last Post: 05 March 2010 - 06:22 AM
Replies To: prime numbers
#2
Re: prime numbers
Posted 05 March 2010 - 06:22 AM
Dim Input as Double = System.Console.Readline()
Dim IsPrime as Boolean = True
If Input / 2 = Input \ 2 then
IsPrime = False
EndIf
If Input / 3 = Input \ 3 then
IsPrime = False
EndIf
If Input / 5 = Input \ 5 then
IsPrime = False
EndIf
If Input / 7 = Input \ 7 then
IsPrime = False
EndIf
If Input / 11 = Input \ 11 then
IsPrime = False
EndIf
If Input / 13 = Input \ 13 then
IsPrime = False
EndIf
If Input / 17 = Input \ 17 then
IsPrime = False
EndIf
If Input / 19 = Input \ 19 then
IsPrime = False
EndIf
If Input / 23 = Input \ 23 then
IsPrime = False
EndIf
If Input / 31 = Input \ 31 then
IsPrime = False
EndIf
'And So On...
If IsPrime = True Then
System.Console.WriteLine("This Is A Prime Number")
Else
System.Console.WriteLine("This Is Not A Prime Number")
Hope This Helps
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|