Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<iostream>
- using namespace std;
- int main()
- {
- long long int a,b,t;
- int mod_b,mod_a,c;
- while(1)
- {
- cin>>a>>b;
- if(a==0&&b==0)
- break;
- c=0;
- int carry=0;
- while(a||b)
- {
- mod_b=b%10;
- mod_a=a%10;
- if(mod_a+mod_b+carry>9)
- {
- c++;
- b=b/10;
- a=a/10;
- carry=1;
- }
- else
- {
- b=b/10;
- a=a/10;
- carry=0;
- }
- }
- if(c==0)
- cout<<"No carry operation.";
- else if(c==1)
- cout<<"1 carry operation.";
- else
- cout<<c<<" carry operations.";
- cout<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment