package 控制语句;
public class for循环找出一到一百中所有的素数 {
public static void main(String[] args) {
int count = 0;
for (int i =2;i <=100;i++){
//这里的这段代码只判断i是否为素数
boolean isSushu = true;
for (int j=2;j<i;j++){
if (i % j == 0){
isSushu = false;
break;
}
}
if (isSushu){
System.out.print(i+" ");
count++;
if (count == 8){
System.out.println();
//归0
count = 0;
}
}
}
}
}