Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,m,s=0;
- for(int i=0; i<=100; i++)
- {
- cin>>m>>n;
- if(m==0 || n==0)
- break;
- if(m>n)
- {
- for(int i=n; i<=m; i++)
- {
- s=s+i;
- cout<<i<<" "<<"Sum= "<<s;
- }
- }
- else if(m<n)
- {
- for(int i=m; i<=n; i++)
- {
- s=s+i;
- cout<<i<<" "<<"Sum= "<<s;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement