while(num!=0)時(shí),會(huì)有count++.num/=10呢?
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
if(num>=0&&num<=999999999){
? ? while(num!=0){
? ? ? ? count++;
? ? ? ? num/=10;
? ? }
? ? System.out.println("它是個(gè)"+count+"位的數(shù)!");
}else{
? ? System.out.println("輸入有誤!");
}
}
}
2019-07-26
while(num!=0){
? ? ? ? count++;
? ? ? ? num/=10;
? ? }//num=999不為零,執(zhí)行。
/運(yùn)算符,結(jié)果等于得到的整數(shù)(商的整數(shù))
System.out.println(
3
/
5
)? =?
0
;
System.out.println(
6
/
5
)? =?
1
;