请问我的这个代码哪里错了?
package com.kk;
public class kk {
public static void main (String[]args){
int a=999;
int b=0;
for(b=0;b<=10;b++){
if(a/10==0){
break;
}else{
a/=10;
b++;
}
}System.out.println(b);
}
}
运行结果是4,哪个地方出错了?
package com.kk;
public class kk {
public static void main (String[]args){
int a=999;
int b=0;
for(b=0;b<=10;b++){
if(a/10==0){
break;
}else{
a/=10;
b++;
}
}System.out.println(b);
}
}
运行结果是4,哪个地方出错了?
2016-09-28
举报