利用Java语言,键盘输入三位数,将其拆分成个位,十位,百位,打印在控制台
关注我,持续更新计算机相关知识与练习、
感谢关注 感谢支持
package com.idheima.demo1;
import java.util.Scanner;
public class hello {
public static void main(String[] args) {
System.out.println("输入三位数");
Scanner number = new Scanner(System.in);
int i = number.nextInt();
int a = i % 10;
int b = (i % 100 - a) / 10;
int c = (i - 10*b - a) / 100;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}