class Test {
public static void main(String[] args) {
for (int i = 1;i<=100 ; ){
for (int y = 1;y <=5&&i<=100 ;y++ ){
if (i%10==9||i/10==9){
i++;
y--;
}else{
System.out.print(i+"\t");
i++;
}
}
System.out.println();
}
}
}
这个题目用while写好还是用for循环写好?求解
我感觉while,比for写的,更复杂有没有
作者: 醉醒 时间: 2016-10-2 13:47
只要能写出正确答案就行了,一般while用来不确定循环次数,for用于确定循环次数作者: 读书可以当饭吃 时间: 2016-10-2 14:29
while更好吧,这是我用while写的
public class Demo2 {