WAP to find whether the entire no. is automorphic. (ie the no. which if we make squre of it, its last digit should be same as the no. itself. ex: 5*5=25,6*6=36,.. are automorphic. while 3*3=9,7*7=49,.. are not)
Printable View
WAP to find whether the entire no. is automorphic. (ie the no. which if we make squre of it, its last digit should be same as the no. itself. ex: 5*5=25,6*6=36,.. are automorphic. while 3*3=9,7*7=49,.. are not)
Its easy to find an number is automorphic or not....Get the last digit of the number. Check if the number is equal to (0 or 1 or 5 or 6 ). If yes then it is an automorphic number otherwise it is not.
-------------------
suresh
take the given number x.
compute y = x*x
compute z = y mod 10
if x == z then yse
else no
The mod operator basically returns the remainder. If mod 10 returns the number that we intitally used to square... you get the idea