不知道哪里錯了
//打印輸出加分后成績,以及加分次數
public class HelloWorld {
??? public static void main(String[] args) {
???????
??????? // 變量保存成績
??????? int score = 53;
???????
??????? // 變量保存加分次數
??????? int count = 0;
??????? //打印輸出加分前成績
?????????
??????? System.out.println("加分前成績:"? +score);
???????
??????? // 只要成績小于60,就循環執行加分操作,并統計加分次數
???????
??????? while(score<60)
??????? {
??????????? score+=1;
??????????? count++;
??????? }
??????? System.out.println("加分后成績:"? +score);
??????? System.out.println(共加了"+count+"次? +count);
}
}
???????
???????
???????
???????
2019-05-07
while(score<60) {
score++;
count++;
}
System.out.println("加分后的成績為"+score);
System.out.println("共加分了"+count+"次!");
你把while循環里的score+=1;? 還有下邊輸出打印的一行 改過來就好了