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

输入的整数范围有多大

Posted by chenmingqiang at 2006-03-01 15:42:27 on Problem 1519
#include<stdio.h>
int main()
{
	long number,digit;
	while(1)
	{
		scanf("%ld",&number);
		if(number==0)
			break;
		while(1)
		{	
			digit=0;	
			do{
				digit+=number%10;
				number/=10;
			}while(number>0);
			if(digit<10)
				break;
			else 
				number=digit;
		}
		printf("%ld\n",digit);
	}
	return 0;
}
				


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