• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem displaying prime no program.  RSS feed

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is to display prime no from 1 to 10
but the output is 2 , 3 , 5 , 7
which is wrong 2 is not a prime no and 1 is but not getting display
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
naved momin wrote:which is wrong 2 is not a prime no and 1 is but not getting display

You are mistaken. 2 is a prime number, and 1 is not a prime number. See Prime for why this is so.
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:
naved momin wrote:which is wrong 2 is not a prime no and 1 is but not getting display

You are mistaken. 2 is a prime number, and 1 is not a prime number. See Prime for why this is so.

thanks buddy
big mistake from my end
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!