Wed Jul 28 2021

Palindrome Number

File Name: palindrome-number.py

#!/usr/bin/evn python

# Take input from the user
num = int(input("Enter a number: "))

temp = num
pnum = 0

# While loop to continue the process until 'temp' reach to '0'
while(temp != 0):
    pnum = temp % 10 + pnum * 10
    # 'temp' divided 10
    temp //= 10

if num == pnum:
    print('%d is a palindrome number' %num)
else:
    print('%d is not a palindrome number' %num)
    


#***** Output *****
# Enter a number: 12321
# 12321 is a palindrome number

#or

# Enter a number: 4654856
# 4654856 is not a palindrome number

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.