Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <iomanip>
  4. using namespace std;
  5. int main(){
  6.    unsigned a, b;
  7.    int saida, q;
  8.    cin>>a>>b;
  9.    while(a!=0||b!=0){
  10.         saida = 0;
  11.         q = 0;
  12.         while(a>0||b>0){
  13.             int k = a%10+b%10;
  14.             a/=10;
  15.             b/=10;
  16.             if(k>=10){
  17.                 saida++;
  18.             }
  19.         }
  20.         if(saida==0){
  21.             cout<<"No carry operation."<<"\n";
  22.         }else if(saida==1){
  23.             cout<<saida<<" carry operation."<<"\n";
  24.         }else{
  25.             cout<<saida<<" carry operations."<<"\n";
  26.         }
  27.         cin>>a>>b;
  28.    }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement