看半天也沒看出來哪里錯了,請大佬指教
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
? ? if(num!=0){
? ? ? ?for(num=num/10;count++){
? ? ??
? ? System.out.println("他是個"+count+"位的數(shù)");
? ? ? ?}??
? ? }
}
}
public class HelloWorld{
public static void main(String[] args){
int num = 999;
int count = 0;
? ? if(num!=0){
? ? ? ?for(num=num/10;count++){
? ? ??
? ? System.out.println("他是個"+count+"位的數(shù)");
? ? ? ?}??
? ? }
}
}
2020-01-26
舉報
2020-02-17
你的for 循環(huán)里面沒有判斷語句,for循環(huán)的判斷語句的作用域只在條件里面(for 后面的小括號)和for后續(xù)的執(zhí)行語句(for后面接的花括號)中。
另外,for (...;...;...) {} 語句中的條件語句的條件可以省略,但是括號中分號是不能缺少的