The System.Numeric.BigInteger class allows for calculating VERY LARGE values.
I created a sample window form app to calculate the factorial of an input value
private void button1_Click(object sender, EventArgs e)
{
int inputValue;
if (int.TryParse(this.textBox1.Text, out inputValue) && inputValue > 0)
{
BigInteger bigInt = 1;
while (inputValue > 1)
{
bigInt = BigInteger.Multiply(inputValue--, bigInt);
}
label1.Text = bigInt.ToString();
label2.Text = bigInt.ToString().Length + " Digits";
}
else
{
label1.Text = "Invalid Input";
label2.Text = "";
}
}
just so you know, 1000! has 2568 digits :)