- package com.heima.demo;
- import java.math.BigInteger;
- import java.util.Scanner;
- public class Demo {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- //用这个类是防止数太大 超过了long的取值范围
- BigInteger b = new BigInteger(Integer.parseInt(sc.nextLine()) +"");
- String str = b.toString();
- for(int x = 0; x < str.length(); x++) {
- System.out.println(str.charAt(x));
- }
- sc.close();
- }
- }
复制代码 |