#include<iostream>
using namespace std;
int sub(int s,int m,int pp)
{
int j=s%10;
int k=m%10;
int l=s/10;
int n=m/10;
if(s>0&&m>0)
{
if(j+k>=10)
{
pp++;
return sub(l+1,n+1,pp);
}
else
{
return sub(l,n,pp);
}
}
return pp;
}
int main()
{
while(1)
{
int s;
int m;
cin>>s;
cin>>m;
if(s==0&&m==0)
break;
sub(s,m,0);
if(sub(s,m,0)==0)
cout<<"No carry operation."<<endl;
else if(sub(s,m,0)==1)
cout<<1<<" carry operation."<<endl;
else
cout<<sub(s,m,0)<<" carry operations."<<endl;
}
}
#include
using namespace std;
int sub(int s,int m,int pp)
{
int j=s%10;
int k=m%10;
int l=s/10;
int n=m/10;
if(s>0&&m>0)
{
if(j+k>=10)
{
pp++;
return sub(l+1,n+1,pp);
}
else
{
return sub(l,n,pp);
}
}
return pp;
}
int main()
{
while(1)
{
int s;
int m;
cin>>s;
cin>>m;
if(s==0&&m==0)
break;
sub(s,m,0);
if(sub(s,m,0)==0)
cout<<"No carry operation."<<endl;
else if(sub(s,m,0)==1)
cout<<1<<" carry operation."<<endl;
else
cout<<sub(s,m,0)<<" carry operations."<<endl;
}
}
99 1 答案錯