public class rui{
static public void main(String[] args){
boolean isSushu = true;
System.out.println("涂涂说101-200的素数有:");
for(int i = 101;i<=200;i++){
for(int j = 2;j<=Math.sqrt(i);j++){
if(i%j == 0){
isSushu = false;
break;
}
}
if(isSushu){
System.out.print(i+" ");
}
isSushu = true;
}
}
}
输出结果:
涂涂说101-200的素数有:
101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199