Python Program To check Weather the number is palindrome or not
- 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
Comments