0

Trying to finish my program for binomial coefficients. It compile but it keeps giving me 0 which is not correct. I think it may be a problem with my for loops but I can't figure it out. Here is the pseudocode:

```
/* 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
}
```

This is what I have so far.

```
if (n < k)
{
return(0) ;
}
else
{
denominator = 1;
for (int i = 1; i <= k; i++)
{ denominator = denominator *i ; }
numerator = 1;
for (int i = n - k + 1; i <= n ; i++)
{ numerator = numerator *i ; }
return (numerator / denominator) ;
}
```

*Edited 6 Years Ago by WaltP*: Added CODE Tags