Reverse The Number - CodeChef Solution

Hello coders, today we will be solving Reverse The Number CodeChef Solution whose Problem code is FLOW007. Given an Integer N, write a program to reve

Hello coders, today we will be solving Reverse The Number CodeChef Solution whose Problem code is FLOW007.

Reverse The Number - CodeChef Solution

Problem

Given an Integer N, write a program to reverse it.

Input

The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N.

Output

For each test case, display the reverse of the given number N, in a new line.

Constraints

  • 1 <= T <= 1000
  • 1 <= N <= 1000000

Example

Input:

4
12345
31203
2123
2300

Output:

54321
30213
3212
32

Solution - Reverse The Number - CodeChef Solution 

Python 3

#Solution provided by Sloth Coders
for _ in range(int(input())):
    N = int(input())
    Rev = 0
    while N > 0:
        Rev = Rev * 10 + N % 10
        N = N // 10
    print(Rev)    

Disclaimer: The above Problem (Reverse The Number) is generated by CodeChef but the Solution is provided by Sloth Coders.

Happy Coding !!

A Sloth Who loves to Code 

Also Read:

Sloth Coders is a Learning Platform for Coders, Programmers and Developers to learn from the basics to advance of Coding of different langauges(python, Java, Javascript and many more).

Post a Comment