| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这么简单的错那了?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator