Scanner sc = new Scanner(System.in);
int d,y = 0;
int x = sc.nextInt();
while (x != 0){
d = x % 10;
y = y * 10 + d;
x = x / 10;
}
System.out.println(y);
經(jīng)典程序設(shè)計(jì)