Programming Examples

Python program to create a function for reverse the number


Write a python program to create a function which reverse the given number

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)
print("Reverse of Number is : ",ans)
Output

Enter any Number 2345

Reverse of Number is :  5432

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 Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz