I have a program here: /*Program to print prime numbers between 1 to n*/ while(i<=n-1) { if((n%i)==0) { break; } i++; } if(i==n) { System.out.println("The prime numbers between 1 and " +n+ " are:"); System.out.println(""+n); } n--; } }
Please help me why this code does not lead me to the end results??? This is a program to find out prime numbers between 1 to N Thanks in advance....
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
4
posted
0
Please don't post the same thing twice. Ask one of the bartenders to move your original thread.