Program to find a number is palindrome or not.

Code:

num = int(input("Enter a number:"))

temp = num

rev = 0

while(num > 0):

    dig = num % 10

    rev = rev * 10 + dig

    num = num // 10

if(temp == rev):

    print("The number is palindrome!")

else:

    print("Not a palindrome!")

 

Output:

Comments

Popular posts from this blog

State use of pep and pip