這樣寫可以嗎
if(num>=0 && num<=999999999){
? ? for(int i=1;i<=num;i*=10){
? ? ? ? count++;
? ? }
? ? System.out.println("它是個(gè)"+count+"位的數(shù)");
}
else{
? ? ?System.out.println("輸入有誤");
? ? }
用for寫的可以嗎
if(num>=0 && num<=999999999){
? ? for(int i=1;i<=num;i*=10){
? ? ? ? count++;
? ? }
? ? System.out.println("它是個(gè)"+count+"位的數(shù)");
}
else{
? ? ?System.out.println("輸入有誤");
? ? }
用for寫的可以嗎
2015-07-14
舉報(bào)
2015-07-14
當(dāng)確定循環(huán)次數(shù)時(shí)用for!
2015-07-14
驗(yàn)證正確