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