Python program to reverse a number

This program reverses a number entered by user and then it print it on the output screen.Example .If the user enters the number 456,the program will return the output as 654.Here the program using modulus(%) operator to obtain the digits of a number.The original number returned from right to left in the output screen.

Program to reverse a number:

Output

Reverse of the number using python

Explanation

The input function used to get the keyboard input from user and int is used to store the user input as numeric in the variable x.Next the function reverse gets called with the input of x and the while loop gets executed until the number greater than zero.