n=int(input("enter value of n "))
n
x=n
rev=0
while(n>0):
r=n%10
rev=(rev*10)+r
n=n/10
if(x==rev):
print("it is a palindrome")
else:
print("given number is not a palindrome")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter