public class PrimeDemo {
public static void main(String[] args) {
// 外层循环,遍历2-200之间的数bai
for (int i = 2; i <= 200; i++) {
// 对100-200之间的每一个数进行遍历
// 质数,正整数,除了1和它本身之外,不能被任何中间数整除
boolean flag = true; // false 不是 质数,true是质数
for (int j = 2; j < i; j++) {
if (i % j == 0) {
// 不是质数
flag = false;
break;
}
}
// 不管是不是质数,都会执行到这里
// 可以根据flag这个标志来判断是否是质数
if(!flag){
continue;
}
System.out.print(i + " ");
}
}
}
public static void countZero(int num) {
int count = 0;
if(num % 1000 == 0)
count = 3;
else if(num % 25 == 0)
count = 2;
else if(num % 5 == 0)
count = 1;
System.out.println(num + "! has " + count + " \"0\".");
}