Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!
Input One N in one line, process to the end of file.
Output For each N, output N! in one line.
Sample Input 1 2 3
Sample Output 1 2 6
JAVA 大数轻松AC!
代码语言:javascript复制import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
BigDecimal n = sc.nextBigDecimal();
BigDecimal m=new BigDecimal(1);
for(int i=2;i<=n.intValue();i ){
m = m.multiply(new BigDecimal(i));
}
System.out.println(m.toPlainString());
}
}
}