Find the bug in this code.

This is a code to to find happy numbers.I don't know what's wrong with it.Please explain.. https://code.sololearn.com/c4Eyj1khqFnV/?ref=app

1/8/2020 6:05:50 PM

Abhishek Kudlur

2 Answers

New Answer


Look at line number 14 , you are actually going to print address of n , not n. In function get_digit , variable 'a' is not declared .


But variable a declared as global variable.Is it necessary to declare in the function also?