Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int a, b, r1, r2, r3=0, sum, ct;
- while(scanf("%d%d",&a,&b)==2){
- if(a==0 && b==0){
- break;
- }
- sum=0;
- ct=0;
- r3=0;
- while(a!=0 && b!=0){
- r1=a%10;
- r2=b%10;
- sum=r1+r2+r3;
- r3=0;
- if(sum>9){
- ct++;
- while(sum!=0){
- r3=sum%10;
- sum/=10;
- }
- }
- a/=10;
- b/=10;
- }
- if(ct==0){
- printf("No carry operation.\n");
- }
- else{
- printf("%d carry operations.\n",ct);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement