public class Test{
public static void main (String[] args){
int i = 0;
int num = 0;
while (i<100){
if (i % 3 == 0){
System.out.println("能被3整除的数:"+i);
}
i = i++;
}
}
}
public static void main (String[] args){
int i = 0;
int num = 0;
while (i<100){
if (i % 3 == 0){
System.out.println("能被3整除的数:"+i);
}
i = i++;
}
}
}
public static void main (String[] args){
int num = 0;
for (int i=0; i<100; i++){
if (i % 3 == 0){
System.out.println("能被3整除的数:"+i);
}
}
}
}用for循环就可以 .while循环不可以啊这是为什么捏?
public static void main(String[] args) { int i = 0; while (i < 100) { if (i % 3 == 0) {
System.out.println("能被3整除的数:" + i);
}
i++;
}
}
}
首先BS下0分贴...再说问题..num 完全没有用到. i=i++; 最BC .. 改成i++ 就好了..
再次BS 下0分贴.. Hoho.
运算后i的值还是没变...