這個為什么沒有對啊 哪里錯了 求大佬告知
public class HelloWorld{
? public static void main(String[] args){
? ? int num = 999;
? ? int count = 1;
? ? int i;
? ? for(i=10;count<10;count++){
? ? ? ? if(num<i){
? ? ? ? ? ? break;
? ? ? ? }
? ? ? ? i=i*10;
? ? }
? ? System.out.println("它是個"+count+"位的數");
? }
}
2017-03-20
????int num = 1234567890;?
????int count = 1;
??? int i;
??for(i=10;num>i;i=i*10){
??????if(count<9){
???????????count++;
??????}else{
???????????count = 0;
???????????break;
???????}
??}
??if(count!=0){
???????System.out.println("它是個"+count+"位的數");
??}else{
???????System.out.println("?數值過大無法判斷");
??}
2017-03-19
你還是學學for循環再考慮你這問題吧!