課程
/后端開發(fā)
/Java
/Java入門第一季(IDEA工具)升級(jí)版
求解該問(wèn)題詳細(xì)程序
2017-04-02
源自:Java入門第一季(IDEA工具)升級(jí)版 4-15
正在回答
public?class?HelloWorld{ public?static?void?main(String[]?args){ ????int?num?=?999; ????int?count?=?0; ????if?(num?>=?0?&&?num?<=?999999999)?{ ????????do?{ ????????????count++; ????????????num?/=?10; ????????}?while?(num?!=?0); ????????System.out.println("它是個(gè)"?+?count?+?"位的數(shù)!"); ????}?else?{ ????????System.out.println("輸入錯(cuò)誤!"); ????} } }
求采納。。
慕粉2334401901 提問(wèn)者
ziom 回復(fù) 慕粉2334401901 提問(wèn)者
public?class?HelloWorld{ public?static?void?main(String[]?args){ int?num?=?999; for(int?i=1;?i<=8;?i++){ ????long?count=1; ????for(int?j=1;?j<=i;?j++){ ????????count?=?count*10; ????} ????if((num/count)==0){ ????????System.out.println("它是個(gè)"+i+"位的數(shù)!"); ????????break; ????} } } }
public class HelloWorld{
public static void main(String[] args){
int num = 999;
for(int i=1; i<=8; i++){
? ? long count=1;
? ? for(int j=1; j<=i; j++){
? ? ? ? count = count*10;
? ? }
? ? if((num/count)==0){
? ? ? ? System.out.println("它是個(gè)"+i+"位的數(shù)!");
? ? ? ? break;
}
舉報(bào)
0基礎(chǔ)萌新入門第一課,從Java環(huán)境搭建、工具使用、基礎(chǔ)語(yǔ)法開始
2 回答switch是什么,求詳細(xì)解釋
6 回答求詳細(xì)解答!用for,謝謝
2 回答詳細(xì)解答
3 回答同樣的問(wèn)題,求詳細(xì)的解釋
3 回答詳細(xì)解答 謝謝
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-04-02
求采納。。
2017-04-18
2017-04-18
public class HelloWorld{
public static void main(String[] args){
int num = 999;
for(int i=1; i<=8; i++){
? ? long count=1;
? ? for(int j=1; j<=i; j++){
? ? ? ? count = count*10;
? ? }
? ? if((num/count)==0){
? ? ? ? System.out.println("它是個(gè)"+i+"位的數(shù)!");
? ? ? ? break;
? ? }
}
}
}