+ 1

What is wrong with this.....they gave no all the time...this is the code of automorfic number

n=int(input("enter number: ")) s=int(n**2) flag=bool(True) while n>0: if (n%10)!=(s%10): flag=bool(False) n/=10 s/=10 if (flag): print("yes") else: print("no")

4th Aug 2021, 11:38 AM
Disha Jain
4 odpowiedzi
+ 6
A number is called Automorphic number if and only if its square ends in the same digits as the number itself. Examples :   N = 76 As 76*76 = 5776, 76 is an automorphuc number (source: https://www.geeksforgeeks.org/automorphic-number/)
4th Aug 2021, 12:18 PM
Lothar
Lothar - avatar
+ 1
Lothar Thank you. What do they call when a number's square starts with the number. like 45*45 =4500, Inverse Automorphic? And why they need to give names to these numbers?
4th Aug 2021, 12:23 PM
▬▬▬
▬▬▬ - avatar
+ 1
According to Lothar 's description, code can be written like: https://code.sololearn.com/cu5T3b265pmk/?ref=app
4th Aug 2021, 1:12 PM
Shadoff
Shadoff - avatar
0
need to convert the new n and s numbers to have int value instead of floating value, i.e. n=int(n/10) , s=int(s/10). Also you may want to return from while loop after flag is set to False.
4th Aug 2021, 12:02 PM
Abhay
Abhay - avatar