怎么利用while循环,输出100、95.......5(100依次减5)
要求,只用while循环输出,实在没有思路了
int num = 100;
while(num>0){
System.out.println(num+"");
num-=5;
}
你可以用while实现输出100、99....1 么?
简单的 while
循环:
public class Main {
public static void main(String[] args) {
int max = 105;
while (max > 5) {
System.out.println(max -= 5);
}
}
}