Programming Examples

Python recursive function to print the reverse of number


Write a recursive function to print the reverse of given number.

Solution:

def reverse(num):
    if num<10:
        print(num)
    else:
        print(num%10,end='')
        reverse(num//10)
n=int(input("Enter any Number : "))
reverse(n)
Output

Enter any Number : 576

675

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 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 Best Website and Software Company in Allahabad