http://acm.cs.nthu.edu.tw/problem.php?pid=7075
#include <stdio.h> int main(int argc, const char * argv[]) { int n1,n2; while (scanf("%d%d",&n1,&n2)!=EOF && !(n1==0&&n2==0)) { int tmp=0; int carry = 0; while (n1||n2) { tmp = (n1%10)+(n2%10)+tmp; tmp/=10; if (tmp) carry++; n1/=10; n2/=10; } if (carry==0) printf("No carry operation.\n"); else if(carry == 1) printf("1 carry operation.\n"); else printf("%d carry operations.\n",carry); } return 0; }