1 package FushiExam;
 2 import java.util.*;
 3 public class Text_24 {
 4 
 5     public static void main(String[] args) {
 6         // 给一个不多于5位的正整数,要求:求它是几位数,逆序打印各位数
 7         Scanner scan=new Scanner(System.in);
 8         String num=scan.nextLine();
 9         char[] arr=num.toCharArray();
10         System.out.println(num+"是"+num.length()+"位数");
11         System.out.println("逆序输出:");
12         for(int i=num.length()-1;i>=0;i--) {
13             System.out.print(arr[i]);
14         }
15     }
16 
17 }

 

相关文章:

  • 2022-12-23
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-12-11
  • 2021-10-01
猜你喜欢
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2021-08-26
相关资源
相似解决方案