101—200之间的素数:共21个。它们是:
101,103,107, 109,113,
127,131,137,139,149,
151,157,163,167,173,
179,181,191,193,197,
199.
public class Su {
public static void main(String[] args) {
int su = 0;
int count = 0;
for (int i = 101; i < 201; i += 2) {
if (isSu(i)) {
su = i;
System.out.println(su);
count++;
}
}
System.out.println(count++);
}
public static boolean isSu(int i){
for (int j = 2; j <= i / 2; j++) {
if (i % j == 0) {
return false;
}
}
return true;
}
}