Given a number 'N', as input single integer value, we have to reverse the number (i.e., digits in the number are to be reversed) and print it.
Consider the following example:
Number , N = 12345
Then the output should be , N = 54321
Input:
54652
Output:
25645
Python Implementation:
Consider the following example:
Number , N = 12345
Then the output should be , N = 54321
Input:
54652
Output:
25645
Python Implementation:
# python program to reverse a number number = int(raw_input()) reverse = 0 while number>0: reverse = (reverse*10) + (number%10) number = number / 10 print reverse