A palindromic number is a number that remains the same when its digits are reversed. For example, 16461.
Write a program that prompts the user to input a number and determine whether the number is palindrome or not.

Source Code

num = int(input("Enter a positive integer: "))
temp = num
rev_no=0
while temp>0:
    digit = temp%10
    rev_no= digit + rev_no*10
    temp= int(temp/10)
if num==rev_no:
    print(num,"is a palindrome")
else:
    print(num,"is not a palindrome")

Output

Enter a positive integer: 16461
16461 is a palindrome