640 - Self Numbers
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 640 - Self Numbers
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 5
- Joined: Fri Aug 02, 2013 1:26 pm
Re: 640 - Self Numbers
My program gives Run Time error...but my program gives expected output in my compiler...i can't detect any error in my code...plz help me...
Thanks ![:lol:](./images/smilies/icon_lol.gif)
![:(](./images/smilies/icon_frown.gif)
Code: Select all
Accepted
![:lol:](./images/smilies/icon_lol.gif)
Last edited by nahin.ruet12 on Sat Sep 20, 2014 7:19 pm, edited 1 time in total.
Re: 640 - Self Numbers
Change your code
Don't forget to remove your code after getting accepted. ![8)](./images/smilies/icon_cool.gif)
Code: Select all
while(num<=1000000)
{
sum=0;
sum=num+digitSum(num);
num=sum;
if(selfNumbers[num]==1)
break;
else
selfNumbers[num]=1;
}
![8)](./images/smilies/icon_cool.gif)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman