While 循环
public class WhileDome01 {
public static void main(String[] args) {
// int a = 101;
// int b = 50;
// int c = 2;
// System.out.println(101*50);
// 计算 1+2+_+100 = ?
int i = 0;
int sum = 0;
while(i<=100){
sum += i++;
}
System.out.println(sum);
}
}
Do while循环
public class DowhileDemo02 {
public static void main(String[] args) {
int i = 0;
int sum = 0;
while (i<0){
System.out.println(i);
}
System.out.println("==============");
do {
System.out.println(i);
}while (i<0);
}
}
for 循环
While do while循环,for循环