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 } }
原创文章,作者:bd101bd101,如若转载,请注明出处:https://blog.ytso.com/277720.html