Write a program to check a number is palindrome or not.
Program:
rev=0
n=int(input("enter no"))
temp=n
while(n>0):
d=n%10
rev=(rev*10)+d #Reverse Number
n=int(n/10)
if(rev==temp):
print("Palindrome")
else:
print("Not Palindrome")
rev=0
n=int(input("enter no"))
temp=n
while(n>0):
d=n%10
rev=(rev*10)+d #Reverse Number
n=int(n/10)
if(rev==temp):
print("Palindrome")
else:
print("Not Palindrome")
Comments
Post a Comment
If you have any doubt, Please let me know..