自己写过的东西,有时候再看看别人写的更优秀的,或许会能提高一些。。。。这个程序翻来覆去一直看,总感觉太棒了,就记录下来吧,这种设计总给人耳目一新的感觉。。。
输入数字不超过9位;
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define STOP system("pause")
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)!=EOF)
{
if(!a&&!b)
return ;
int c,ans=0;
for(int i=9;i>=0;i--)//这一点c不支持。。。。
{
c= (a%10 +b%10 +c)>9 ?1:0;//耳目一新。。。。
ans+=c;
a/=10;
b/=10;
}
printf("%d\n",ans);
}
return 0;
}