package lianxi; import java.util.*; public class Nixudayin { public static void main(String[] args) { System.out.println("输入一个不多于5位的正整数"); Scanner shu=new Scanner(System.in); String a=shu.next(); System.out.println("输入的是"+a.length()+"位数"); System.out.println("逆序打印:"); for (int i = a.length()-1; i >= 0; i--) { System.out.print(a.substring(i,i+1)); } } }
时间: 2024-12-08 00:05:59