Find the bug in this code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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

8th Jan 2020, 6:05 PM
Abhishek Kudlur
2 Answers
+ 1
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 .
9th Jan 2020, 10:22 AM
Shubham Vilayatkar
Shubham Vilayatkar - avatar
0
But variable a declared as global variable.Is it necessary to declare in the function also?
9th Jan 2020, 10:26 AM
Abhishek Kudlur