这个运行的结果也对的,为什么说是错的呢
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
int i=0;
while(i<=10){
if(num/(Math.pow(10,i))>=1){
count++;
}else break;
i++;
}
System.out.println("它是个"+count+"位的数!");
}
}
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
int i=0;
while(i<=10){
if(num/(Math.pow(10,i))>=1){
count++;
}else break;
i++;
}
System.out.println("它是个"+count+"位的数!");
}
}
2019-12-20
举报