#include<iostream>
using namespace std;
int main()
{
unsigned long long int a, b;
int c, d, e, f, y;
while(cin >> a >> b)
{
d = y = c = 0;
if(a == 0 && b == 0)
{
break;
}
while(a!=0 || b!= 0)
{
e = f = 0;
if(a>0)
{
e = a%10;
a = a/10;
}
if(b>0)
{
f = b%10;
b = b/10;
}
d = e + f + y;
y = d/10;
if(y>0)
{
c++;
}
}
if(c == 0)
cout << "No carry operation." << endl;
else if(c == 1)
cout << 1 << " carry operation." << endl;
else
cout << c << " carry operations." << endl;
}
return 0;
}
using namespace std;
int main()
{
unsigned long long int a, b;
int c, d, e, f, y;
while(cin >> a >> b)
{
d = y = c = 0;
if(a == 0 && b == 0)
{
break;
}
while(a!=0 || b!= 0)
{
e = f = 0;
if(a>0)
{
e = a%10;
a = a/10;
}
if(b>0)
{
f = b%10;
b = b/10;
}
d = e + f + y;
y = d/10;
if(y>0)
{
c++;
}
}
if(c == 0)
cout << "No carry operation." << endl;
else if(c == 1)
cout << 1 << " carry operation." << endl;
else
cout << c << " carry operations." << endl;
}
return 0;
}
Comments
Post a Comment