ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

SelfNumber ----java
Posted by sisiforyou 12 Oct 2008 18:28
i dont know how to set the frist...
this is my program i wanna start from 1 but it start from 2..
thks :-)...



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;
}
}
}