This is to calculate the factorial of a non-negative integer.