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 }