這個可以輸出答案為什么通過不了
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
for(count=1;count<10;count++){
? ? num=num/10;
? ? if(num<=0){break;}
}
System.out.println("它是個"+count+"位的數!");
}
}
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
for(count=1;count<10;count++){
? ? num=num/10;
? ? if(num<=0){break;}
}
System.out.println("它是個"+count+"位的數!");
}
}
2016-02-24
舉報
2016-03-02
你把for循環里面的count=1給去掉就行了
2016-02-25
num是整型,num/=10 ,就是類似于取整,10/10=1 ? , ?11/10=1 ? , ?12/10=1 ? ? ...... ? ?19/10=1
2016-02-25
額,有點不理解如果num算到0,6不是要四舍五入的嗎?
2016-02-25
if中條件有問題
num始終大于0
2016-02-24
和默認答案不一樣,除了設置好的默認答案其他答案不論對錯都不行