输入一个三位数,把个位和百位对调后输出

时间:2023-02-22 15:12:09

Description

输入一个三位自然数,然后把这个数的百位数与个位数对调,输出对调后的数

Input

输入一行,只有一个整数x(100<=x<=999)。
 

Output

输出只有一行,包括1个整数。

Sample Input 

123

Sample Output

321
 
太水了。。。
AC代码:
 1 import java.util.Scanner;
 2 
 3 public class Main {
 4     public static void main(String[] args) {
 5         Scanner sc = new Scanner(System.in);
 6         String str = sc.next();
 7         int num = Integer.parseInt(str.charAt(2)+""+str.charAt(1)+""+str.charAt(0));
 8         System.out.println(num);
 9     }
10 }