public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int start = sc.nextInt();//开始的累加的数字
int end = sc.nextInt();//累加结束的数字
int i = start;
int sum = 0;//累加的和
while(i <= end){//循环累加
sum += start;
start++;
i++;
}
System.out.println(sum);
sc.close();
}
运行结果: