Plz solve this logical error in Anti-Lychrel Numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Plz solve this logical error in Anti-Lychrel Numbers

https://code.sololearn.com/cl3bDJ1Du7W5/?ref=app

28th Aug 2018, 4:40 AM
Abhishek Shailendra Khandare
Abhishek Shailendra Khandare - avatar
2 Answers
+ 7
Corrected the code copy and paste this it rev=0, rem=0; while(num > 0) { rem=num%10; num/=10; rev=rev*10+rem; } printf ("\n%d\n", rev); if (rev==number) { printf ("\n%d: number is palindrome\n",number); return 0; } else { num=number+rev; goto A; }
28th Aug 2018, 5:43 AM
blACk sh4d0w
blACk sh4d0w - avatar
0
when I used goto statement in my program , after jump to 'A' value stored in 'num'variable is 'zero' can u tell reason behind it??
30th Aug 2018, 4:22 AM
Abhishek Shailendra Khandare
Abhishek Shailendra Khandare - avatar