# Automorphic Number Problem

Ranajoy Saha

Ranch Hand

Posts: 43

1

posted 3 years ago

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!

posted 3 years ago

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.

Henry

Ranajoy Saha wrote:

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.

Henry

Ranajoy Saha

Ranch Hand

Posts: 43

1

posted 3 years ago

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!

But still the output is the same as before!