java类库:大数字阶乘

package start;


import java.math.BigInteger;

import java.util.Scanner;


public class Start {
    public static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        String a = new String();
        a = scanner.nextLine();
        BigInteger bigInteger = new BigInteger(a);
        BigInteger tmp = bigInteger.add(BigInteger.valueOf(-1));
        while (!tmp.equals(BigInteger.valueOf(0))) {
            bigInteger = bigInteger.multiply(tmp);
            tmp = tmp.add(BigInteger.valueOf(-1));
        }
        System.out.print(bigInteger);

    }
}

猜你喜欢

转载自blog.csdn.net/jtjljy/article/details/80480372
今日推荐