top of page

Python Program To check Weather the number is palindrome or not

  • Writer: Jino Shaji
    Jino Shaji
  • Jan 18, 2015
  • 1 min read

Updated: Jun 9, 2020




# Python Program To check Weather the number is palindrome or not
# Author : JINO SHAJI
num=int(input(“Enter a Number : “))
i=1
j=abs(num);
print (int(j/10));
count=1
while(j>0):
    j=int(j/10)
    count*=10
count=int(count/10)
j=num
result=0
while(j>0):
    k=j%10
    j=int(j/10)
    result=result+(k*count)
    count=int(count/10)
if result==num:
    print (“%d is Palindrome” %(num))
else:
    print(“%d is not Palindrome” %(num))

Result :

Enter a Number : 256 25 100 256!=652 >>> ================================ RESTART ================================ >>> Enter a Number : 452 45 100 452 is not Palindrome >>> ================================ RESTART ================================ >>> Enter a Number : 12121 1212 10000 12121 is Palindrome >>> ================================ RESTART ================================ >>> Enter a Number : 121 12 121 is Palindrome

Recent Posts

See All
Program to Create an investment report.

“””Program: investment.py Author: JINO SHAJI Compute an investment report. 1. The inputs are        starting investment amount       ...

 
 
 
Multi-­‐Line Statements in Python

Statements in Python typically end with a new line. Python does, however, allow the use of the line continuation character (\) to denote...

 
 
 

Comments


bottom of page