我怎么只循環(huán)了一次
public class HelloWorld {
? ? public static void main(String[] args) {
? ? ? ??
? ? ? ? // 變量保存成績
? ? ? ? int score = 53;?
? ? ? ??
? ? ? ? // 變量保存加分次數(shù)
? ? ? ? int count = 0;
? ? ? ? do{
? ? ? ? ? ? count++;
? ? ? ? ? ? score=score+count;
? ? ? ? }while(score>60);
? ? ? ? ? ?
? ? ? ??
? ? ? ?
? ? ? ? System.out.println("加分前成績:53");
? ? ? ? System.out.println("加分后成績:60");
? ? ? ? System.out.println("共加了"+(count)+"次!");
? ? ? ?}
}
2019-06-05
因?yàn)閟core<60,所以do while循環(huán)只執(zhí)行了一遍,執(zhí)行的到while判斷為假就跳出循環(huán)了