//使用while计算从m到n的和 public class Test1 { public static void main(String[] args) { int sum = 0; int m = 20; int n = 100; // 使用while计算M+...+N: while(m>=20&&m<=100) { sum=sum+m; m++; } System.out.println(sum); } }
Sign in to make a reply
吕归尘丶