为什么这样写出来的结果是0,不是650?
public class Demosum {
public static void main(String[] args) {
int sum = 0;
int i = 0;
do {
sum = i + sum;
i++;
} while (i % 2 == 0 && i < 51);
System.out.println("求和是:" + sum);
}
public class Demosum {
public static void main(String[] args) {
int sum = 0;
int i = 0;
do {
sum = i + sum;
i++;
} while (i % 2 == 0 && i < 51);
System.out.println("求和是:" + sum);
}
2018-09-19
举报