-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10035 A.c
More file actions
45 lines (35 loc) · 769 Bytes
/
10035 A.c
File metadata and controls
45 lines (35 loc) · 769 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
44
45
/// Name: Md. Samshad Rahman
/// Prob: 10035 - Primary Arithmetic
#include <stdio.h>
int main()
{
long int a, b;
int c, s;
while(scanf("%ld %ld", &a, &b))
{
if(a == 0 && b == 0)
{
break;
}
c=0, s=0;
do
{
s = (a%10 + b%10 + s)/10;
a = a/10;
b = b/10;
if(s == 1)
c = c+s;
}
while((a != 0) || (b != 0));
if(c == 0)
printf("No carry operation.\n");
else
{
if(c == 1)
printf("1 carry operation.\n");
else
printf("%d carry operations.\n", c);
}
}
return 0;
}