Discuss / Java / andrewdong

andrewdong

Topic source

友谊NASA

#1 Created at ... [Delete] [Delete and Lock User]
public class Main {
	public static void main(String[] args) {
		int sum = 0;
                int m = 20;
		int n = 100;
		// 使用do while计算M+...+N:
		do {
                sum += m++;
		} while (m <= n);
		System.out.println(sum);
	}
}

  • 1

Reply