by R4R Team

What is palindrome number ?

- A number which is equal to the reverse of itself. like an example '1221' it is a number and its reverse is also 1221 so both number and it's reverse are equal that's by this number is called as palindrome number.

program -

print("Enter number")
n=int(input())
a=n
n1=0
while(a):
t=a%10
n1=n1*10+t
a=int(a/10)

if n==n1:
print("Palindrome")
else:
print("Not palindrome")

output -

Enter number
1234
Not palindrome


Enter number
1221
Palindrome



- In this program, firstly we reversed the input number then we compare input number and it's reversed, if both are same then it is palindrome otherwise it is not palindrome.
Leave a Comment: