In this example, you will learn to reverse a number entered by user.
Here, User will enter 1234 and program will convert into 4321.
#Python Program to Reverse a Number no = int(input("Enter Number to reverse ::")) rev = 0 while(no > 0): temp = no % 10 rev = rev * 10 + temp no = no // 10 print("Reverse number is :: ",rev)
Enter Number to reverse ::1234 Reverse number is :: 4321
Ask anything about this examples