20170727 JAVA练习题:输入一个三位数字,将其倒序组合输出

时间:2022-01-12 12:30:38
JAVA练习题:输入一个三位数字,将其倒序组合输出 package com.chy.g2;
import java.util.Scanner;
public class Exercise1 {
public static void main(String[] args) { // TODO Auto-generated method stub int b, c, d = 0; System.out.println("请输入数字:");
Scanner sc = new Scanner(System.in); int num = sc.nextInt(); b = num / 100; num %= 100; c = num / 10; num %= 10; d = num / 1; int result=d*100+c*10+b; System.out.println("结果是"+result); }
}