求大神幫忙看看哪里出錯了?
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
if(num>=0 && num<=999999999){
? ? while(num!=0){
? ? ? ? count++;
? ? ? ? num=num/10; ??
? ? }
? ? System.out.println("它是個"+count+"位數(shù)!");
}
}
}
2016-04-09
其實(shí)你這代碼沒有錯的,在eclipse上也運(yùn)行的起來,不用管系統(tǒng)判你是否錯誤。如果你一定想要經(jīng)驗(yàn)值的話,就把答案復(fù)制進(jìn)去就行了
2016-04-09
public class Test01 {
????public static void main(String[] args){
???????? int num=999;
???????? int count=0;
???????? for(int i=10;i<=1000000000;i=i*10){
???????????? count++;
???????????? if(num<i){
???????????????? System.out.println("這個數(shù)是"+count+"位的數(shù)!");
???????????????? break;
????????????????}
????????}
????}
}
2016-04-09