........求改
能幫忙看看那里出錯了嗎?
?if (0<=num<999999999){
?? ?count=count++;
?? ?for(;;count++){?
?? ? ? ?if(0<=(num-10*count))?
?? ? ? ?continue;
?? ?}
?????????}else{ ?
??????????????System.out.println("數(shù)據(jù)不符合判斷條件!")?
}
?System.out.printlm("它是個"+count+"位的數(shù)!")
?}
?}
2016-12-04
10的次方,不是10*count。而是要用Math.pow(10,count)這種形式,需要提前導(dǎo)入math。具體可百度
2016-12-04
作用域也有問題,for循環(huán)里面的count變量在for循環(huán)結(jié)束后就釋放空間。
int count=0;
?while(0<=num<999999999){
?? ?count=count++;
? ? num=10*count;
? ? }
? ??System.out.printlm("它是個"+count+"位的數(shù)!")
2016-12-04
?if (num>0 && num<=999999999){
?? ?while(num != ?0){?
? ? ? ??count=count++;
? ? ? ?num/ = 10;
?? ? ? ?continue;
?? ?}? ? ? ? ? ? ?
?System.out.println("它是個"+count+"位的數(shù)!")?
}? else{
?System.out.printlm("數(shù)據(jù)不符合判斷條件!")
?}