prime numbers

i need a prime numbers examples

Page 1 of 1

1 Replies - 2939 Views - Last Post: 05 March 2010 - 06:22 AM Rate Topic: -----

#1 mani2012  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 1
  • Joined: 04-March 10

prime numbers

Posted 04 March 2010 - 07:58 PM

i need a prime numbers in console application in vb.net
Is This A Good Question/Topic? -2
  • +

Replies To: prime numbers

#2 clboyrun  Icon User is offline

  • New D.I.C Head

Reputation: -4
  • View blog
  • Posts: 14
  • Joined: 19-January 10

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
Was This Post Helpful? -1
  • +
  • -

Page 1 of 1