#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include<algorithm>
using namespace std;
void main()
{
int a, b,n,i,sum=0,j;
scanf("%d %d", &a, &b);
n = b - a;
sum = 0;
for (i = 0,j=1; i <=n; i++,j++)
{
printf("%5d ",a);
sum += a;
a++;
if (j % 5 == 0) printf("\n");
}
printf("\n");
printf("%d", sum);
}
时间: 2024-09-30 00:32:08