Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long int a,b,c,sum;
- while(cin>>a>>b){
- if(a>b)
- {
- c=a;
- a=b;
- b=c;
- }
- sum= (((b*(b+1))/2)-((a*(a+1))/2))+a;
- printf("Sum of %lld to %lld is -> %lld;\n",a,b,sum);}
- return 0;
- }
- © 2019 Toph | Furqan Software
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement