Python Program to Print Number in Reverse Order
def Reverse(n): #user-defined function
# calculate reverse of number
rev = 0
rem = 0
while n > 0:
rem = n % 10
rev = rev * 10 + rem
n = int(n / 10)
return rev
# take user inputs
num = int(input("Enter any number:"))
# calling function and display result
reversenumber = Reverse(num)
print(f'The reverse order of {num} is :', reversenumber)
Output:
Enter any number:123456789
The reverse order of 123456789 is : 987654321
0 टिप्पण्या
कृपया तुमच्या प्रियजनांना लेख शेअर करा आणि तुमचा अभिप्राय जरूर नोंदवा. 🙏 🙏