Binomial coefficient in C# : <p>Hi I need to find an algorithm to compute the binomial coefficient. 
<a href="https://imgur.com/a/nGCw4n7" rel="nofollow noreferrer">https://imgur.com/a/nGCw4n7</a>
n is 3, while k must go from 0 to 3. </p>

<p>I found this link with the code which explains how to calculate the binomial coefficient <a href="http://csharphelper.com/blog/2014/08/calculate-the-binomial-coefficient-n-choose-k-efficiently-in-c/" rel="nofollow noreferrer">http://csharphelper.com/blog/2014/08/calculate-the-binomial-coefficient-n-choose-k-efficiently-in-c/</a> but I don't know how to do when k is not assigned. </p>

<p>This is the code I found:</p>

<pre><code>decimal result = 1;
for (int i = 1; i &lt;= K; i++)
{
    result *= N - (K - i);
    result /= i;
}
return result;
</code></pre>
