package Test;
//判断101-200之间的素数
public class isPrime {
public static void main(String[] args) {
boolean b = false;
for (int i = 101; i < 201; i++) {
for (int j = 2; j <= i - 1; j++) {
if (i % j == 0) {
b = false;
break;
} else {
b = true;
}
}
if (b == true) {
System.out.print(i + " ");
}
}
}
//判断101-200之间的素数
public class isPrime {
public static void main(String[] args) {
boolean b = false;
for (int i = 101; i < 201; i++) {
for (int j = 2; j <= i - 1; j++) {
if (i % j == 0) {
b = false;
break;
} else {
b = true;
}
}
if (b == true) {
System.out.print(i + " ");
}
}
}
}
结果:101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199