- import java.util.*;
- public class DuShu {
- public static void main(String[] args){
- Scanner in=new Scanner(System.in);
- int[] arr={0,1,2,3,4,5,6,7,8,9};
- char[] Ch={'零','一','二','三','四','五','六','七','八','九'};
- int num,index;
- System.out.println("请输入数字:");
- num=in.nextInt();
- index = num%10;
- StringBuilder sb = new StringBuilder();
- sb.append(Ch[index]);
- while(num/10!=0) {
- num = num/10;
- index = num%10;
- sb.append(Ch[index]);
- }
- System.out.println(sb.reverse().toString());
- }
- }
复制代码 |