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

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

請(qǐng)問大家關(guān)于這道題這個(gè)哪里不對(duì)。結(jié)果為52 62 4

package mayday;

class yesor{

public static void main(String[] args){

int score = 52;

int count = 0;

System.out.println(score);

package mayday;

class yesor{

public static void main(String[] args){

int score = 52;

int count = 0;

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

while(score<60){count++;score=score+count;

}

System.out.println("加分后"+score);

System.out.println("加分次數(shù)"+count);

}}


正在回答

4 回答

public class HelloWorld {
??? public static void main(String[] args) {
???????
??????? // 變量保存成績
??????? int score = 53;
???????
??????? // 變量保存加分次數(shù)
??????? int count = 0;


??????? //打印輸出加分前成績
???????? System.out.println("加分前成績:"+score) ;
??????
???????
??????? // 只要成績小于60,就循環(huán)執(zhí)行加分操作,并統(tǒng)計(jì)加分次數(shù)
???????
??????? while (score<60){
??????????? count++;
??????????? score++;
??????? }
????????????
??????? //打印輸出加分后成績,以及加分次數(shù)
????????? System.out.println("加分后成績:"+score);
????????? System.out.println("共加了"+count+"次!");


錯(cuò)誤在于??score=score+count

正確寫為? score++??? //這里表示自加 1

你的寫的代碼有點(diǎn)兒復(fù)雜啦,用一個(gè)簡單的循環(huán)語句(while)就可以了。

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

score=score+count;錯(cuò)了 應(yīng)該是 score+=1;或者 score=score+1;

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

score=score+count; 錯(cuò)了,應(yīng)該是score++;

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

我多復(fù)制了一次,大家從第二個(gè)package mayday;開始看

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

因扎吉_ 提問者

還有我寫錯(cuò)了,初值是53,不過也不影響
2017-08-30 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

請(qǐng)問大家關(guān)于這道題這個(gè)哪里不對(duì)。結(jié)果為52 62 4

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

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

幫助反饋 APP下載

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

公眾號(hào)

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