package struct; public class While { public static void main(String[] args) { //输出1~100 int a=0; while (a<100){ a++; System.out.println(a); } //计算1+2+3+4+......100 int b=0; int c=0;//和 while (b<=100){ c=b+c; b++; } System.out.println(c);//5050 } }