Here is a sample Python program that reverses an integer value:
This program defines a function reverse()
that takes an integer num
as input and returns the reversed version of the number. The function uses a while loop to reverse the digits of the number one by one, and then returns the reversed number.
The function is then tested by calling it with the input 54321
. The output should be 12345
, which is the reversed version of the input number.