• Post Reply Bookmark Topic Watch Topic
  • New Topic

What's the problem with my code?  RSS feed

 
Derryl Larson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
fred rosenberger
lowercase baba
Bartender
Posts: 12562
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes you think there is a problem with it? Please TellTheDetails (<---click that).

Next. the code you provided won't compile. It has to be inside a class - and the above is not. You need something like


around it...but you may have that since I don't think the braces you have are correct...I think you have an extra closing brace at the end.

So please make sure you post ALL your code, and tell us what EXACTLY you are seeing and what you are doing when you see it.
 
Derryl Larson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The programm will consider every n except 2 not prime and I have no idea why.
 
Derryl Larson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the full code, including the classname
 
fred rosenberger
lowercase baba
Bartender
Posts: 12562
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look carefully at line 9...And tell me where exactly you think the body of the "if" is...

Hint - it's pretty small...
 
Derryl Larson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*facepalm*
spotted/fixed it now. thanks for the quick help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!