forked from mahmudahsan/203-ACM-Problems-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10035.cpp
More file actions
executable file
·43 lines (36 loc) · 757 Bytes
/
Copy path10035.cpp
File metadata and controls
executable file
·43 lines (36 loc) · 757 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
32
33
34
35
36
37
38
39
40
41
42
43
/* Problem: Primary Arithmetic UVa 10035 PC 110501
Programmer: Md. Mahmud Ahsan
Compiled: Visual C++ 6.0
*/
#include <iostream>
using namespace std;
int main(){
long int a, b, c , _a, _b, result, carry;
while (cin >> a >> b){
if ( a == 0 && b == 0) break;
carry = c = 0;
while (a != 0 || b != 0){
_a = a % 10;
a = a / 10;
_b = b % 10;
b = b / 10;
result = _a + _b + c;
if (result >= 10){
c=1;
carry += 1;
}
else
c=0;
}
if (carry == 0){
cout << "No carry operation." << endl;
}
else if (carry == 1){
cout << carry << " carry operation." << endl;
}
else if (carry > 1){
cout << carry << " carry operations." << endl;
}
}
return 0;
}