| ||||||||||
| 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 | |||||||||
Re: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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator