*我在projecteuler中被困在#20中。 我似乎熟悉寻找阶乘的价值,但我无法获得100阶乘的价值。 *
答案 0 :(得分:1)
如Jon Skeet所述,您应该使用BigInteger。
//Add reference of System.Numerics.dll
using System.Numerics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
BigInteger factorial = 1;
var factorialOfNumber = 100;
for (var i = 1; i <= factorialOfNumber; i++)
{
factorial *= i;
}
Console.WriteLine("Required factorial of {0} is {1}", factorialOfNumber, factorial);
}
}
}