Description
编写程序将整数逆序输出。如输入为9876输出为6789
Main函数中读入n个整数,输出n个整数的逆序数
Input
整数个数n
n个整数
Output
n个整数的逆序数
Sample Input
3
1234
2323
1112
Sample Output
4321
3232
2111
package org.sdust.cise;
import java.util.*;
public class Main{
static String Reverse(String s)
{
String r = "";
for(int i = s.length() - 1;i>=0;i--)
{
r+= s.charAt(i);
}
return r;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
String s = "";
String revers = "";
for(int i = 0;i<=num;i++)
{
s = scan.next();
if(!s.equals("\n"))
{
revers = Reverse(s);
System.out.println(revers);
}
}
}
}