~cpp #include <iostream> using namespace std; int input1[10], input2[10], carry[10], number1, number2; int counting, i, j, k; char temp; void getCarryNum() { counting=0; for(i=0; i<10; i++) carry[i]=0; for(i=number1-1, j=number2-1, k=9; i>=0 || j>=0; i--, j--, k--) { if(i<0) { if(input2[j] + carry[k]>9) { carry[k-1]=1; counting++; } } else if(j<0) { if(input1[i] + carry[k]>9) { carry[k-1]=1; counting++; } } else { if(input1[i] + input2[j] + carry[k]>9) { carry[k-1]=1; counting++; } } } if(counting==0) cout << "No carry operation." << endl; else if(counting==1) cout << "1 carry operation." << endl; else cout << counting << " carry operations." << endl; } int main() { while(true) { number1=0; while(cin.peek()!=' ') { cin >> temp; input1[number1++] = temp-48; } number2=0; while(cin.peek()!='\n') { cin >> temp; input2[number2++]= temp-48; } if(input1[0]==0 && input2[0]==0) break; getCarryNum(); } return 0; }