/*
* 使用while/do-while/for循环三种方式打印100以内4的倍数
*/
public class Test2 {
public static void main(String[] args) {
System.out.println("while");
int i = 0;
while (i <= 100) {
if (i % 4 == 0) {
System.out.println(i);
}
i++;
}
System.out.println("do-while");
i = 0;
do {
if (i % 4 == 0) {
System.out.println(i);
}
i++;
}while (i <= 100);
System.out.println("for");
for (i = 0; i <= 100; i++) {
if (i % 4 == 0) {
System.out.println(i);
}
}
}
}