Programming Example

Write a Python program to input any number and check number is Palindrome or Not using Function

Solution

def reverse(num):
    rev=0
    while num>0:
        rev=rev*10+(num%10)
        num=num//10
    return rev
num=int(input("Enter any Number "))
ans=reverse(num)
if num==ans:
    print("Number is Palindrome ")
else:
    print("Number is Not Palindrome")
Output

Enter any Number 5245

Number is Not Palindrome

>>> 

=================== 

Enter any Number 10001

Number is Palindrome 

>>> 

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad