package Demo1;
public class while1 {
public static void main(String[] args) {
int i = 0,sum = 0;
while ((i=i+2) <= 100){
sum += i;
//2.while (i <= 100) {
//if (i%2 == 0)
//sum += i;
// i++;
//3.sum += i;
//i += 2;
}
System.out.println("偶数和是:"+sum);
}
}
while
最新推荐文章于 2023-03-14 16:49:57 发布