為什么這個輸出來顯示“”它是個1位的數“”
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
?do ?{
? count= count + 1;
? num = num/10;
}
while(num < 1);
? System.out.println("它是個"+count+"位的數");
}
}
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
?do ?{
? count= count + 1;
? num = num/10;
}
while(num < 1);
? System.out.println("它是個"+count+"位的數");
}
}
2016-10-11
舉報
2016-10-11
while里面的表達式寫錯了,應該改為while(num>1);
2016-10-11
do.....while();循環里面的條件給他限制了