Prime number program
807598Feb 10 2006 — edited Feb 10 2006Hi, i'm having a bit of trouble with a program im writing as homework assignment. So far i have
public class isPrime {
public isPrime() {
boolean nff;
int factor;
nff = true;
for( i=2; 2<N; i++){
factor =2;
while( nff && factor<= N){
if (N % factor == 0){
nff = false;
}else factor ++;
}
if( nff){
System.out.print(factor);
}
}
where i need some help is after the System.out.print, i need the program to count how many prime numbers have occured and then print the total number of primes out
i dont have any clue as to how i should increment this