| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
拜托,帮我看看哪里错了.......万分感谢!!!!!#include<stdio.h>
#include<string.h>
main()
{
int i,n,j;
char a[9],b[9];
while(scanf("%s%s",&a,&b)&&((a[0]-'0')||(b[0]-'0')))
{
if(strlen(b)<10&&strlen(a)<10)
{
n=0;
for(i=(strlen(a)-1);i>=0;i--)
{
j=(strlen(b)-1);
if((j<0)||(i<0))
break;
if((a[i]-'0')+(b[j]-'0')>=10)
{
n++;
a[i-1]=a[i-1]+'1';
}
j--;
}
if(n==0)
{
printf("No carry operation.\n");
}
else if(n==1)
printf("%d carry operation.\n",n);
else
printf("%d carry operations.\n",n);
}
else
break;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator