公共和儿媳

Discuss / Java / 作业

作业

Topic source

云苏666

#1 Created at ... [Delete] [Delete and Lock User]
import java.util.Scanner;public class learn {    public static void main(String[] args){        int sum = 0;        Scanner scanner = new Scanner(System.in);        System.out.println("请输入m的值:");        int m = scanner.nextInt();        System.out.println("请输入n的值:");        int n = scanner.nextInt();        while (m <= n){            sum = sum + m ;            m ++ ;        }        System.out.println("从m一直加到n的值为:"+sum);    }}

  • 1

Reply