题目描述
数字序列和它的和
样例
#include <iostream>
using namespace std;
int main() {
int m, n, sum;
scanf("%d%d",&m,&n);
while ( m > 0 && n > 0 )
{
sum = 0;
if ( m > n ) swap(m, n);
for ( int i = m; i <= n; i ++ )
{
printf("%d ",i);
sum += i;
}
printf("Sum=%d\n",sum);
scanf("%d%d",&m,&n);
}
return 0;
}