Binomial coefficient is a positive integer that occur as coefficient in the Binomial Theorem. It can be defined as the coefficient of the monomial Xk in the expansion of (1 + X)n .
This coefficient also occurs in the formula given below
#include <stdio.h>
int Coeff(int n, int k)
{
if (k > n)
return 0;
if (k == 0 || k == n)
return 1;
return Coeff(n - 1, k - 1)
+ Coeff(n - 1, k);
}
int main()
{
int n , k ;
printf("Enter first number : \n");
scanf("%i",&n);
printf("Enter second number : \n");
scanf("%i",&k);
printf("Value of K(%d, %d) is %d ", n, k,
Coeff(n, k));
return 0;
}

Leave a comment