求大神?。?!
public static void main(String [] args){
int score=53;
int count=0;
System.out.println("加分前的成績"+score);
for (count=0;score<60;count++){
count=count+1;
score=score+1;
}
System.out.println("加分后的成績"+score);
System.out.println("共加了"+count+"次");
}
}
這代碼哪里有問題???為什么輸出的次數是14,分數正確。
2016-03-26
你把 //count=count+1;這行代碼刪掉,你上面for循環(huán)里就有count++了,這樣相當于count在每個循環(huán)里加了兩次。