Write a program to reverse a number


Topic: Write a program to reverse a number

Solution

n=int(input("Enter number: "))
rev=0
while(n>0):
    dig=n%10
    rev=rev*10+dig
    n=n//10
print("Reverse of the number:",rev)



List all Python Programs