Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int min(int i,int j)
- {
- //int s = ;
- return i<j?i:j;
- }
- int bi_co(int n,int k)
- {
- int c[n+1][k+1], i, j;
- for(i=0;i<=n;i++)
- {
- for(j=0;j<=min(i,k);j++)
- {
- if(j==0||j==i)
- c[i][j] = 1;
- else
- c[i][j] = c[i-1][j-1]+c[i-1][j];
- }
- }
- return (c[n][k]);
- }
- void main()
- {
- int n = 5, k = 2;
- int B = bi_co(n,k);
- printf("%d, %d, %d", n,k,B);
- }
Add Comment
Please, Sign In to add comment