Computer Science, asked by andekarmaheshwari132, 1 year ago

write the python program to find whether the number is a palindrome or not?

Answers

Answered by Anonymous
9

Answer:

n=int(input("Enter number:"))

temp=n

rev=0

while(n>0):

dig=n%10

rev=rev*10+dig

n=n//10

if(temp==rev):

print("The number is a palindrome!")

else:

print("The number isn't a palindrome!")

Answered by duragpalsingh
1

Hey there!

The program is as follows:

num = input('Enter any number : ')

try:

   val = int(num)

   if num == str(num)[::-1]:

       print('The given number is PALINDROME')

   else:

       print('The given number is NOT a palindrome')

except ValueError:

   print("That's not a valid number, Try Again !")

Note: See the program in python and output in attached image.

Attachments:
Similar questions