public class TestZhiShu {
public static void main(String[] args) {
int num = 0;
for (int i = 2; i <= 100; i++) {
boolean isExists = false;
for (int j = 2; j < (i / 2 + 1); j++) {
num++;
if (i % j == 0) {
isExists = true;
break;
}
}
if (!isExists) {
System.out.print(i + " ");
}
}
System.out.println("num = " + num);
}
}
public class TestHeShu {
public static void main(String[] args) {
for (int i = 2; i < 100; i++) {
boolean isHeShu = false;
for (int j = 2; j < i; j++) {
if (i % j == 0) {
isHeShu = true;
break;
}
}
if (isHeShu) {
System.out.print(i + " ");
}
}
}
}