1. 程式人生 > >java求大數的階乘

java求大數的階乘

import java.math.*;
import java.util.Scanner;

public class LargeNumber{
	public static void main(String[] args){
		BigInteger result=BigInteger.ONE;
		Scanner cin=new Scanner(System.in);
		int n=cin.nextInt();
		for(int i=1;i<=n;i++){
			result=result.multiply(new BigInteger(i+""));
			
		}
		System.out.println(result);
	}

}