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 xinjing at 2007-07-31 15:05:33 on Problem 1519
#include<stdio.h>
int main()
{
  long int n,sum;

  while(1)
  {
  	scanf("%ld",&n);
    if(n==0)break;
    while(n/10)
    {
      sum=0;
      while(n)
      {
        sum+=n%10;
        n/=10;
      }
      n=sum;
    }
    printf("%ld\n",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