Factorial

This algorithm finds the factorial of a given number.



									public static long Factorial(int number)
{
	if (number < 0)
		return -1; //Error

	long result = 1;

	for (int i = 1; i <= number; ++i)
		result *= i;

	return result;
}
								


Example

									long factorial = Factorial(10);
								


Output

									3628800