A program that generates the reverse of a given number X. Printing all the corresponding reverse numbers.
Note: If a number has trailing zeros, then its reverse will not include them.
Input format :
Output format :
Sample Input :
Sample Output :
Solution :
- N = int(input())
- rev_n = 0
- while N > 0:
- a = N % 10
- rev_n = (rev_n * 10) + a
- N = N // 10
- print(rev_n)
- N = int(input())
- rev_n = 0
- while N > 0:
- a = N % 10
- rev_n = (rev_n * 10) + a
- N = N // 10
- print(rev_n)
Tags:
Solutions