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 |
Help!!Why Output limit Exceed? #include <iostream.h> #include <string.h> void main() { char a[100],p[100]="0"; int n,m,i; short mm; cin >>a; while (strcmp(a,p)!=0) { n=0; for (i=0;i<(int)strlen(a);i++) n=n+a[i]-'0'; do{ m=0; while (n) { m=m+(n%10); n=n/10; } n=m; } while (m>10); mm=(short)m; cout <<mm<<endl; cin >>a; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator