Question 6
[15
Write a menu driven program to input a number and check whether the number is
palpalindrome or an automorphic number.
(A number is palpalindrome if it is palindrome and prime eg 111 and a number is
automorphic if the unit digit of a number is same as square of number. Eg 52=25 both
have unit place 5)
Answers
The following cσdes have been written using Python.
while True:
n = int(input("Enter a number: "))
print()
print("1. Check if the number is a palindrome.")
print("2. Check if the number is an automorphic.")
print("3. Exit.")
print()
c = int(input("Enter your choice: "))
print()
if c == 1:
nn = str(n)
if nn[::] == nn[::-1]:
print(n, "is a palindrome number.")
print()
else:
print(n, "is not a palindrome number.")
print()
elif c == 2:
nn = str(n)
ns = n**2
nns = str(ns)
if nn in nns:
print(n, "is an automorphic number.")
print()
else:
print(n, "is not an automorphic number.")
print()
sc = input("Do you want to proceed? [Y/N]: ")
print()
if sc == "Y" or sc == "y":
continue
else:
break