Hello all, I'm very confused on this K factor stuff.....I understand that...12…*k indicates the product of consecutive numbers and therefore:
1*2*…*5
is actually
1*2*3*4*5 = 120
But I'm not sure how to write that as a code. I have the following information:
/* pseudocode for Binomial
Coefficients */
int binomial(int n, int k)
{
If (n < k) Then return (0)
Else
{
Set denominator = 1*2*...*k
Set numerator = (n-k+1)*(n-k+2)*...*(n-1)*n
return (numerator / denominator)
} // else
End if
}
Does k represent 5 or just any number?? Is there some type of formula???