Home > Back-end >  JAVA
JAVA

Time:10-13

Title:
Given a number n, you are required to output its reverse counterpart. That is, the most significant digit become the list significant digit and so on. There are several test cases for each test group.

Input: Test case count T following by each Test case. Example:
5
12000
11111
012
5
- 23

Output:
21
11111
21
5
32
-Code:
import java.util.*;
Public class Main
{
Public static void main (String [] args)
{
Scanner s=new Scanner(System.in);
Int n=s.n extInt ();
for(int i=0; i{
String a=s.n ext ();
Char [] arr=a.t oCharArray ();
Char t;
B=new char char [] [30].
D=new char char [] [30].
Int j=0;
Int e=Integer. ParseInt (a);
If (e==0)
B [0]='0';
The else
{for (; j{
If (arr [j].='0' & amp; & Arr [j].='-')
{
B [j]=arr [j];
}
}
}
If (e<0)
{System. Out. Print (" - ");
For (int c=b.l ength - 1; C> 0; C -)
System. The out. Print (b) [c]; }
The else
C={for (int b.l ength - 1; C>=0; C -)
System. The out. Print (b) [c]; }
System.out.println();
}
}
}
Note: output and platform's form, but still wrong,