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 <stdlib.h> #include <string.h> int main () { long N,sum=0,i; char str[100]; memset(str,'0',100); while(1) { scanf("%d",&N); while(N>0) { sprintf(str,"%99d",N); for(i=0;i<strlen(str);i++) { if(str[i]==' ') sum=0; else sum+=str[i]-'0'; } N=sum; if(N<=9&&N>=0) { printf("%d",N); break; } } printf("\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator