Daffodil International University
Problem Link
//Please follow from main function
#include<stdio.h>
int main()
{
int x,sum,y;
while(1)
{
scanf("%d %d", &x, &y);
sum=0;
if(x<=0 || y<=0)
{
break;
}
if(x<y)
{
for(x; x<=y; x++)
{
printf("%d ", x);
sum+=x;
}
printf("Sum=%d\n", sum);
}
else if(y<x)
{
for(y; y<=x; y++)
{
printf("%d ", y);
sum+=y;
}
printf("Sum=%d\n", sum);
}
}
return 0;
}
0 Comments