方法一:非递归实现
static BigInteger myFatorFun(BigInteger n)
{
if (n == 0)
return 1;
BigInteger temp = 1;
for (BigInteger i = 1;i<=n;i++)
{
temp = temp * i;
}
Console.WriteLine("计算结果是:" + temp.ToString());
return temp;
}
方法二:递归实现
static BigInteger myFatorFun2(BigInteger n)
{
if (n == 0)
return 1;
BigInteger temp = myFatorFun2(n - 1) * n;
Console.WriteLine("计算结果是:" + temp.ToString());
return temp;
}