Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Help!!

Posted by 00348307 at 2004-03-13 01:36:27 on Problem 1519
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator