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

Re:1316为什么这也会错?想不通呀

Posted by sisiforyou at 2008-10-12 19:25:15 on Problem 1316
In Reply To:1316为什么这也会错?想不通呀 Posted by:orange at 2003-09-08 18:27:40
public class SelfNumbers
{
public static void main (String args[]) throws Exception
{
int i = 1;
int sum=0,recu,result=0,i_first;
while(result<10)
{
i_first = i; 
sum=0;
do
{
recu = i%10;
i= i/10;
sum+=recu;

}
while(i!=0);
result=sum+i_first;
if(result<=10) 
System.out.println(result );
i=result;
}
}
}

i use java..and also feel puzzle..
i wanna start from 1 ,but it start form 2..

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