public class Prime_number {
public static void main(String[] args) {
int count = 0;
for(int x=101; x<200; x+=2) {
boolean f = false;
for(int j=2; j<=Math.sqrt(x); j++){if(x % j == 0){
f = false;
break;
}else{
f = true;
}
if(f == true) {count ++;System.out.println(x );
}
System.out.println( "素数个数是: " + count);
}
}
}
}
|
|