While循环
//1+2+...+100;
int i =0;
int sum=0;
while (i<=100){
sum=sum+i;
i++;
}
System.out.println(sum);
DoWhile循环
int a=0;
while (a<0){ //while循环是先判断 在决定是否执行
System.out.println(a);
}
System.out.println("=========================");
do {
System.out.println(a); //doWhile循环是先执行一次在判断
}while (a<0);
标签:int,sum,System,while,While,循环,println,out From: https://www.cnblogs.com/wukangxiang/p/17258884.html