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

这样都能WA?

Posted by ic0500510123 at 2005-12-04 21:09:06 on Problem 1519
#include<stdio.h>
#include<math.h>

void main()
{
	while(1)
	{
		int n;
		scanf("%d",&n);
		if(n==0) break;
loop:
		int j=log10(n)+1,i,k=0;
		for(i=0;i<j;i++)
		{
			k+=n%10;
			n=n/10;
		}
		if(k<10) printf("%d\n",k);
		else 
		{
			n=k;
			goto loop;
		}
	}
}

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