錯在哪兒哪
public class lianxi02 {
public static void main(String[] ags){
? ? int count =0;
? ? for(int i =101;i <200;i=2){
? ? boolean b =false;
? ? for(int j=2; j<=Math.sqrt(i);j++){
? ? }
? ? if(i % j ==0){b=false;break;}?
? ? else ? ? {b=true;}
? ? }
? ? if(b ==true){count++;System.out.println(i);}
? ? ? ? ? ? ? ? ? ??
? ? System.out.println("素數(shù)個數(shù)是:"+count); }
}
2018-06-27
int count =0;
? ?for(int i =101;i <200;i++){
? ?boolean b =false;
? ?for(int j=2; j<=Math.sqrt(i);j++){
? ?if(i % j ==0){b=false;break;}?
? ?else ? ? {b=true;}
? ?}
? ?if(b==true){count++;}
? ?}
? ?System.out.print("素數(shù)個數(shù)是:"+count);
2015-08-08
第一層循環(huán)? i等于2? 錯
第二層循環(huán)的括號放錯了