while练习
Topic source/** * @author cjv * 测试while使用 */public class TestWhile { public static void main(String[] args) { /** * 使用while计算从m到n的和 */ int sum = 0; int m = 20; int n = 100; // 使用while计算M+...+N: while (m <= n) { sum += m; m++; } System.out.println(sum); }}
- 1
凌翊CJV