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 |
Why WA?#include <stdio.h> #include <string.h> #include <stdlib.h> void main() { int n,i; char a[15]; while(1) { scanf("%d",&n); if(n==0) break; while(n>9) { itoa(n,a,10); n=0; for(i=0;i<strlen(a);i++) { n+=a[i]-'0'; } } printf("%d\n",n); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator