How to Check Number is Palindrome or Not in Python Program
What is Palindrome Number?
Palindrome Number is that number if the reverse of that
number is equal to Original number then we say this number is palindrome.
For Example:
Original Number: 12421
Reverse: 12421
12421 is Palindrome Number
Example: Code Program
num = int(input("Enter Number:"))
temp = num
rev = 0
while num > 0:
rem = int(num%10)
rev = rev * 10 + rem
num = int(num/10)
if temp == rev:
print(temp," is Palindrome")
else:
print(temp, " is Not Palindrome")
temp = num
rev = 0
while num > 0:
rem = int(num%10)
rev = rev * 10 + rem
num = int(num/10)
if temp == rev:
print(temp," is Palindrome")
else:
print(temp, " is Not Palindrome")
Java Program
Java Program to Check the Number is Palindrome or Not
Post a Comment