正整数N(0<=N<=1000)
输入可能包括多组数据,对于每一组输入数据,输出N的阶乘
链接:https://www.nowcoder.com/questionTerminal/f54d8e6de61e4efb8cce3eebfd0e0daa 来源:牛客网 import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); while(in.hasNextInt()){ int N = in.nextInt(); BigInteger sum = BigInteger.valueOf(1); for(int i=1;i<=N;i++) sum = sum.multiply(BigInteger.valueOf(i)); System.out.println(sum); } } }
原文:https://www.cnblogs.com/JAYPARK/p/10111332.html