Factorial

This algorithm finds the factorial of a given number.



									function Factorial($number)
{
	if ($number < 0)
		return -1; //Error

	$result = 1;

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

	return $result;
}
								


Example

									$factorial = Factorial(10);
								


Output

									3628800