📅  最后修改于: 2022-03-11 14:52:44.436000             🧑  作者: Mango
import java.util.Scanner;
public class Main{
public static void main (String[] args) {
int M,N,i,j,sum = 0;
Scanner obj = new Scanner(System.in);
for(i = 1; i <= 3; i++){
M = obj.nextInt();
N = obj.nextInt();
for(j = N,sum = 0; j <= M; j++){
if(N <= 0){
System.exit(1);
}else{
System.out.printf("%d ", j);
sum += j;
}
}
System.out.println("Sum=" + sum);
}
}
}