forked from gmendonca/uri-problem-solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1101.cpp
More file actions
31 lines (25 loc) · 648 Bytes
/
1101.cpp
File metadata and controls
31 lines (25 loc) · 648 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
using namespace std;
int main(){
int n;
int x, y, aux;
int soma;
while(true){
cin >> x;
cin >> y;
if(x <= 0) break;
if(y <= 0) break;
if(x > y){
aux = x;
x = y;
y = aux;
}
soma = 0;
for(int i = x; i <= y; i++){
cout << i << " ";
soma += i;
}
cout << "Sum=" << soma << endl;
}
return 0;
}