Scanner inn = new Scanner(System.in); int i = inn.nextInt(); System.out.println("个位是"+i%10+"十位是"+i/10%10+"百位是"+i/100%10+"千位是"+i/1000%10); Scanner inn = new Scanner(System.in); String s = inn.next(); for (int i=0;i&l
//在JS中,将text框中数据格式化,根据不同的小数位数,格式化成对应的XXX,XXX,XXX.XX(2位小数) 或者XXX,XXX,XXX(0位小数) function formatNum(num, n) {//参数说明:num 要格式化的数字 n 保留小数位 num = String(num.toFixed(n)); })/; while (re.test(num)) num = num.replace(re, "$1,$2") return num; }
求一个数数的个位数,十位数,百位数及千位: int num = 53; int g = (num / 1) % 10; //个位 int s = (num / 10) % 10; //十位 int b = (num / 100) % 10; //百位 int b = (num / 1000) % 10; //千位 amount = String.valueOf(this.dealAmountByXXQ(new BigDecimal(amount), new BigDecimal