n!(n的阶乘)公式,求阶乘的公式

发布时间:2020-07-10 07:59:52

n!(n的阶乘)公式,求阶乘的公式

网友回答

public class Example
  { //求10的阶道乘回
   public static void main(String[] args)
   { int sum=1;
   for(int i=1;i<=10;i++)
   { sum*=i;
   }
   System.out.println(sum);
  
   }
  }
  public class Example
  // 求阶乘方法答
   public static int factorial(int n)
  {
   int result = 1;
   for(int i = 1;i<=n;i++)
   result *= i;
   return result;
   }
  }

网友回答

阶乘copy没有公式,要一个一个的算,
  20以内的数的阶乘
  阶乘一般很难计算,因为积都很大。
  以下列出1至20的阶乘:zd
  1!=1,
  2!=2,
  3!=6,
  4!=24,
  5!=120,
  6!=720,
  7!=5040,
  8!=40320
  9!=362880
  10!=3628800
  11!=39916800
  12!=479001600
  13!=6227020800
  14!=87178291200
  15!=1307674368000
  16!=20922789888000
  17!=355687428096000
  18!=6402373705728000
  19!=121645100408832000
  20!=2432902008176640000
以上问题属网友观点,不代表本站立场,仅供参考!