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

用串读, int 太小了,

Posted by peanutgyz at 2004-05-11 22:43:40 on Problem 1519
In Reply To:这个程序哪儿错了? Posted by:hz02ruc at 2003-11-08 23:47:05
> #include<stdio.h>
> int n;
> void find_digitalroot()
> {	
> 	int sum=100,count=0;
> 	while(sum>=10)
> 	{
> 		
> 		if(count>=1)
> 			n=sum;	
> 		sum=0;
> 		while(n>0)
> 		{
> 			sum+=n%10;
> 			n/=10;
> 		}
> 		count++;
>          }
> 	printf("%d\n",sum);
> }
> int main()
> {
> 	scanf("%d",&n);
> 	while(n!=0)
> 	{
> 		find_digitalroot();
> 		scanf("%d",&n);
> 	}
> 	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