给一个不多于 5 位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字?

日期:2020-08-31 15:59:47 人气:1

给一个不多于 5 位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字?

public class Prog24{ public static void main(String[] args){ int n = Integer.parseInt(args[0]); int i = 0; int[] a = new int[5]; do{ a[i] = n%10; n /= 10; ++i; }while(n!=0); System.out.print(&qu
    A+
热门评论