| ||||||||||
| 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 | |||||||||
实际不用这么繁...In Reply To:求救,为什么啊WA Posted by:xiaoha at 2005-08-15 14:54:57 #include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
unsigned int a,b;
int c,i,counter;
while(1){
counter=0;
scanf("%ld%ld",&a,&b);
if(a==0&&b==0) break;
c=0;
while(1){
if(a==0&&b==0) break;
c=(a%10+b%10+c)/10;
if(c>0) counter++;
a=a/10;b=b/10;
}
if(counter==0) printf("No carry operation.\n");
else{if(counter>1) printf("%d carry operations.\n",counter);
else{printf("%d carry operation.\n",counter);}}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator