Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long long int a,b,temp,c,d,sum;
- while(scanf("%lld%lld",&a,&b)!=EOF){
- if (a>b){
- temp=a;
- a=b;
- b=temp;
- }
- a=a-1;
- c=(a*(a+1))/2;
- d=(b*(b+1))/2;
- sum=d-c;
- printf("Sum of %lld to %lld is -> %lld;\n", a+1,b,sum);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement