#include <stdio.h> #include <string.h> //非常简单的代码,应该一目了然,就不解释了 int main() { int a,b; while (scanf("%d %d", &a, &b) != EOF) { if (a==0&&b==0){ break; } int count=0; int jinwei=0; //这是低位的进位 while (a!=0 || b!=0) { //算到两数都变为0,就算两数长短不一也不影响,大不了短的那个后面一直是0 int n1=a%10; int n2=b%10; if (n1+n2+jinwei>=10){ count++; jinwei=1; }else { jinwei=0; } a/=10; b/=10; } if (count==0){ printf("NO carry operation.\n"); }else if (count==1){ printf("1 carry operation.\n"); }else { printf("%d carry operations.\n", count); } } return 0; }