#include<conio.h>

int binomial(int n,int k)

{

int i,j,a[10][10];

for(i=0;i<=n;i++)

{

a[i][0]=1;

a[i][i]=1;

}

for(i=2;i<=n;i++)

{

for(j=1;j<=i-1;j++)

{

a[i][j] = a[i-1][j] + a[i-1][j-1];

}

}

return a[n][k];

}

int main()

{

int n,k,res;

printf("\n Enter the value for n : ");

scanf("%d",&n);

printf("\n Enter the value for k : ");

scanf("%d",&k);

res=binomial(n,k);

printf("\n The binomial co-efficient is %d\n",res);

getch();

}
## No comments:

Write comments