原连接:https://blog.csdn.net/qq_27139155/article/details/79702758java
我之前遇到过,可是写的不够简单,比较复杂spa
代码以下:.net
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc =new Scanner(System.in); int num=sc.nextInt(); int f[]=new int[10]; //四位数 f[0]=(num)%10; f[1]=(num/10)%10; f[2]=(num/100)%10; f[3]=(num/1000)%10; System.out.print(f[3]+" "+f[2]+" "+f[1]+" "+f[0]); } }