问题描述

输入一个正整数n,输出n!的值。

n!=123*…*n。

输入格式

输入一个正整数n,n<=1000。

输出格式

输出n!的值。
样例输入
10
样例输出
3628800

	public static void main(String[] args) {
		
		BigInteger mul = new BigInteger("1");
		Scanner scanner = new Scanner(System.in);
		BigInteger n = scanner.nextBigInteger();
		//i.compareTo(n)相等则返回0   , i<n 返回负数,i>n返回正数
		for (BigInteger i = BigInteger.ONE; i.compareTo(n) <= 0; i = i.add(BigInteger.ONE)) {
			mul = mul.multiply(i);
		}
		System.out.println(mul);
	}

关于大数值
大整数阶乘
大整数阶乘

相关文章:

  • 2022-12-23
  • 2021-10-31
  • 2022-01-19
  • 2021-08-18
猜你喜欢
  • 2022-12-23
  • 2022-01-23
  • 2021-07-21
相关资源
相似解决方案