Try it and see. Better yet guess first: what do you think i%j will yield if j is 1? And how will that affect the numbers you report as prime.
Personally I don't regard 1 as prime, but if you...
Type: Posts; User: pbrockway2
Try it and see. Better yet guess first: what do you think i%j will yield if j is 1? And how will that affect the numbers you report as prime.
Personally I don't regard 1 as prime, but if you...
if(i == j){
output.println(" "+i);}
}
We can be quite sure that won't print a "1" because j has just gone through a for loop where it was set to 2 and made to increment.
Prime number -...
If you want someone to suggest why the code you're using doesn't output 1, then you'll have to post the code you're using...
Also note that 1 isn't a prime number.