top of page
  • Subham Das

Palindrome Number

A palindromic number or numeral palindrome is a number that remains the same when its digits are reversed. That means if any number is reversed or we arrange the numbers in opposite order then will be same as it is. Or we can also say that number is symmetrical. Example: 131,16461 etc. We can observe that they are symmetrical.


For extracting any digits from a number, we need to divide the number with 10 and the remainder will be the last digit of that number. In these way can extract any digit from any number.


# Program to check a number is palindrome or not.

num = eval(input("Enter Number:"))

# Storing the number 'num' in a another variable.

n = num

num1 = 0

while n ! = 0 :

rem = n%10

n = n//10

# Here we are storing the reverse number in 'num1'.

num1 = num1 * 10 + rem

if num == num1 :

print("Pallindrome Number")

else :

print("Not a Pallindrome Number")






33 views3 comments

Recent Posts

See All

Magic Number

It is a composite number whose sum of the digits is 10. If we extract the digits from the number then the sum of these digits will be 10. Are confused with the statement 'math.log(i, 10) + 1' ? This i

Prime Number or Not

This program checks a number is mathematically prime or not. It is a optimize program to check a number is prime number or not. # Program to check a number is prime or not. n = eval(input("Enter Numbe

logo12.PNG
bottom of page