write a programme in python to check wheather a no. is palindrome or not
Answers
Answered by
2
Heya !!
Here's the code...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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. Please try again.")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hope it helps !!
Answered by
0
Answer:
Explanation:
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!")
Similar questions