循环结构图
public class TestWhile {
public static void main(String[] args) {
/*int a = 1;
while(a<=100) {
System.out.println(a);
a++;
}
System.out.println("结束循环");
*/
//1+2+3....+100的和
int b = 1;
int c = 0;
while(b<=100) {
c = c + b;
b++;
System.out.println(c);
}
//dowhile的用法,其实就是先做循环内容再判断布尔表达式。通俗点就是逻辑反过来的while循环
int d = 1;
int e = 0;
do {
e = e + d;
System.out.println(e);
d++;
}while(d<=100);
}
}