package Example_one;
public class java_01 {
public static void main(String[] args) {
int count=0;
System.out.println("101~200的素数有:");
for(int i=101;i<=200;i++){
int j=2;
while(i%j!=0){
j++;
}
if(i==j){
System.out.println(i);
count++;
}
}
System.out.println("总数:"+count);
}
}
运行结果
101~200的素数有: 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 总数:21 Process finished with exit c



