输入N求N的阶乘的准确值。
Input 输入N(1 <= N <= 10000) Output 输出N的阶乘 Sample Input
5Sample Output
120代码:
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner cin = new Scanner(System.in); int n; n = cin.nextInt(); BigInteger sum = new BigInteger("1"); for(int i=1;i<=n;i++) { sum=sum.multiply(BigInteger.valueOf(i)); } System.out.println(sum); } }