I have created this program which checks a number is Automorphic or not. Automorphic numbers are the numbers whose square ends with the number itself or you can say it is a number whose square ends with the given integer. Eg. Square of 5 is 25 As 25 has the last digit 5 so 5 is an automorphic number. This porgram is always giving me "The number is a automorphic number." no matter whatever number I try. I cant detect the problem in this program. Please help!

I have created this program which checks a number is Automorphic or not. Automorphic numbers are the numbers whose square ends with the number itself or you can say it is a number whose square ends with the given integer. Eg. Square of 5 is 25 As 25 has the last digit 5 so 5 is an automorphic number. This porgram is always giving me "The number is a automorphic number." no matter whatever number I try. I cant detect the problem in this program. Please help!

If you follow the code, how often is the check variable set? And what is it set to? ... Interestingly, this value is the same regardless of what number the user enters.

Ok, Henry Thanks for helping! Previously the check variable was initialized with 0 as num then was 0 and there was no change at all. But now I first initialized the check variable to 0 and then after the user has entered some input then it get's initialized by num.
But still the output is the same as before!

Ranajoy Saha
Ranch Hand

Joined: Jan 17, 2013
Posts: 33

posted

0

Thanks for the help Henry Wong! Thank you very much! I corrected my mistake!