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 jackch at 2006-09-23 22:35:28 on Problem 1519
#include<iostream>
using namespace std;
int main()
{
    int n;
    while(cin>>n&&n)
    {
        int s=0;
    loop:
       while(n)
      {  s+=n%10;
         n/=10;
      }
      if(s>=10){n=s;s=0;goto loop;}
      else n=s;
      cout<<n<<endl;
    }
    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