Automorphic Number

Published by Mubashir Hassan in

A number is called Automorphic number if its square ends in the original number. Create a function that takes a number n and returns true if it is an Automorphic number, otherwise false.

Examples

automorphic(1) ➞ true

automorphic(3) ➞ false
# 3^2 = 9

automorphic(6) ➞ true
# 6^2 = 36 (ends with 6)

automorphic(95) ➞ false
# 95^2 = 9025 (does not end with 95)

Notes

N/A

Watch a quick demo on how Edabit works.