Reverse of a number
Level EASY
Write a program to generate the reverse of a given number N. Print the corresponding reverse number.
Note : If a number has trailing zeros, then its reverse will not include them. For e.g., reverse of 10400 will be 401 instead of 00401.
Input format :
Output format :
Constraints:
Sample Input 1 :
Sample Output 1 :
Sample Input 2 :
Sample Output 2 :
891
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverse(n): | |
#Implement Your Code Here | |
n=str(n) | |
print(int("".join(reversed(n)))) | |
n=int(input()) | |
result = reverse(n) |
Comments
Post a Comment
Please give us your valuable feedback