public void twoQuestionAnswer(){
System.out.println("***************第二题****************");
int total = 0;
for (int j=100;j<=200;j++){
boolean flag=false;
for (int i = 2; i <= Math.sqrt(j); i++) {
if (j % i == 0) {// 不是素数
flag = true;
break;
}
}
if (!flag){
total++;
System.out.print(j + "_");
}
}
System.out.print("总数为:"+total);
}
public static void main(String[] args) {
ArithmeticOne arithmeticOne = new ArithmeticOne();
arithmeticOne.twoQuestionAnswer();
}
***************第二题****************
101_103_107_109_113_127_131_137_139_149_151_157_163_167_173_179_181_191_193_197_199_总数为:21