File size: 531 Bytes
c4b0eef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#include <cstdio>

int main()
{
	int firstInt,secondInt,c, total;
	while ( scanf("%d %d",&firstInt,&secondInt), firstInt || secondInt )
	{
		total = c = 0;
		while ( firstInt || secondInt )
		{
			if ( firstInt % 10 + secondInt % 10 + c > 9 )					{
				total++;
				c = (firstInt%10+secondInt%10+c)/10;
			}	
			else
				c = 0;
			firstInt /= 10;
			secondInt /= 10;
		}
		if ( total == 1 )
			puts("1 carry operation.");
		else if ( total )
			printf("%d carry operations.\n", total);
		else
			puts("No carry operation.");
	}
}