亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么不適用于100.10.220.。等等 的整十的數

public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
for(count=0;count<10;count++){
???
num=num/10;
??? if(num<=1){
????? count++;
????? break;
??? }
}
??????? System.out.println("它是個"+count+"位的數!");
}
}

正在回答

2 回答

public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
for(count=0;count<10;count++){
???
num=num/10;
??? if(num<=0){
????? count++;
????? break;
??? }
}
??????? System.out.println("它是個"+count+"位的數!");
}
}

0 回復 有任何疑惑可以回復我~

public class HelloWorld{
public static void main(String[] args){
int num = 2364724;
?? ??? ?int count =0;
?? ??? ?? for(;num>=1;){
?? ??? ??? ?? count++;
?? ??? ??? ?? num = num / 10;
?? ??? ?? }

??????? System.out.println("它是個"+count+"位的數!");
}
}

你的邏輯有點問題 ,仔細想想就可以了!



0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么不適用于100.10.220.。等等 的整十的數

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號