這道題錯在哪里?
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("它是個"+count+"位的數(shù)");
}else{
System.out.println("輸入有誤!");
}
2022-03-26
是的,前些天為這個問題困擾了好一會。對于計算機來說35/4就等于8你沒有定義一個double的變量的話,是不存在小數(shù)這個運算的計算機直接裁掉了
2018-10-12
你少了兩個花括號括回去(建議規(guī)范使用eclipse編譯軟件)