例如:輸入 123,輸出321
import java.util.Scanner;
public class C1
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("請入一個三位數:");
int a = input.nextInt();
int b = a / 100;
int c = ( a - b * 100 ) / 10;
int d = a - 100 * b - 10 * c;
System.out.println("結果為:" + d + c + b);
}
}
沒有留言:
張貼留言