public class Test1 {
public static void main(String[] args) {
int count = 0;
for (int i = 100; i <= 200; i++) {
boolean b = true;
for (int j = 2; j < i; j++) {
if (i % j == 0) {
b = false;
break;
}
}
if (b) {
System.out.println(i);
count++;
}
}
System.out.println(count);
}
}
|
|