哪里錯了?應(yīng)該怎么改
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
int i=1;
while (num%i!=0){
? ? i=i*10;
count++;}
System.out.println("它是個"+ count+"位的數(shù)!");
}
}
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
int i=1;
while (num%i!=0){
? ? i=i*10;
count++;}
System.out.println("它是個"+ count+"位的數(shù)!");
}
}
2018-09-22
舉報
2018-09-23
public class HelloWorld{
public static void main(String[] args){
? ? int num = 999;
? ? int count = 0;
? ? int i=1;
? ? while (num/i != 0){
? ? ? ? i=i*10;
? ? ? ? count++;
? ? }
? ? System.out.println("它是個"+ count+"位的數(shù)!");
? ? }
}
把%換成/
2018-09-22
當(dāng)i等于1,你求余數(shù)肯定是0