66. Python Program to find the Reverse of a given number.
How does this program work?
- This program is used to find the Reverse of a given number using Python.
- The integer entered by the user is stored in variable n.
- Declare variable a to store reverse number and initialize it with 0.
- Multiply the reverse number by 10, add the remainder which comes after dividing the number by 10.
Here is the code
n = int(input("Enter number: "))
a = 0
while n > 0:
b = n % 10
a = a*10+b
n//=10 #(n = int(n/10))
print("Reverse of a given number is: ",a)