第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

大神們 看看這個(gè)哪里錯(cuò)了

package?a001;

public?class?zgx001?{
	public?static?void?main(String[]?args)?{
		int?i=53;int?n=0;
		System.out.println("加分前成績:"+i);
		do{i++;n++;}
		while(i>=60);
			
		System.out.println("加分后成績:"+i);
		System.out.println("共加了"+n+"次!");
	?}
	}


正在回答

5 回答

??while(i<=60);

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

精慕門6253780 提問者

非常感謝!
2016-10-23 回復(fù) 有任何疑惑可以回復(fù)我~

public class HelloWorld {

? ? public static void main(String[] args) {

? ? ? ??

? ? ? ? // 變量保存成績

? ? ? ? int score = 61;?

? ? ? ??

? ? ? ? // 變量保存加分次數(shù)

? ? ? ? int count = 0;



? ? ? ? //打印輸出加分前成績?

? ? ? ? ? System.out.println("加分前成績"+score);

? ? ? ?

? ? ? ??

? ? ? ? if(score<60){

? ? ? ? ? ? while(score<60){

? ? ? ? ? ? ? ? count++;

? ? ? ? ? ? ? ? score = score+1;

? ? ? ? ? ? }

? ? ? ? ? ? System.out.println("一共加分"+count+"次成績合格");

? ? ? ? }else{

? ? ? ? ? ? System.out.println("您的成績已經(jīng)合格不需要加分");

? ? ? ? }// 只要成績小于60,就循環(huán)執(zhí)行加分操作,并統(tǒng)計(jì)加分次數(shù)

? ? ? ??

? ? ? ??

? ? ? ??

? ? ? ??

? ? ? ??

? ? ? ??

? ? ? ??

? ? ? ? //打印輸出加分后成績,以及加分次數(shù)

? ? ??




? ? }

}


0 回復(fù) 有任何疑惑可以回復(fù)我~


package?a001;

?

public?class?zgx001?{

????public?static?void?main(String[]?args)?{

????????int?i=53;

????????int?n=0;

????????System.out.println("加分前成績:"+i);

????????do{

????????????i++;

????????????n++;

????????}while(i>=60); ? //主要是錯(cuò)在這里,do-while 語句是先執(zhí)行語句后判斷條件,只有條件成立了,才會繼續(xù)循環(huán),一直到條件不成立了才會結(jié)束循環(huán),再執(zhí)行以下的語句。所以改成?while(i<=60); 就可以了

?????????????

????????System.out.println("加分后成績:"+i);

????????System.out.println("共加了"+n+"次!");

?????}

}


? ?



1 回復(fù) 有任何疑惑可以回復(fù)我~

while(i<60)

0 回復(fù) 有任何疑惑可以回復(fù)我~

while內(nèi)容為true則執(zhí)行,你搞反了

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

大神們 看看這個(gè)哪里錯(cuò)了

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號