#include<bits/stdc++.h>
using namespace std;
int binomial(int n, int k)
{
int r = 1, i;
for(i=n-k+1;i<=n;i++)
r = r * i;
for(i=2;i<=k;i++)
r = r / i;
return r;
}
int main()
{
int n, k;
cout << "Enter Two Number :: ";
cin >> n >> k;
cout << "Binomial Coefficient Is :: ";
cout << binomial(n, k) << endl;
return 0;
}
using namespace std;
int binomial(int n, int k)
{
int r = 1, i;
for(i=n-k+1;i<=n;i++)
r = r * i;
for(i=2;i<=k;i++)
r = r / i;
return r;
}
int main()
{
int n, k;
cout << "Enter Two Number :: ";
cin >> n >> k;
cout << "Binomial Coefficient Is :: ";
cout << binomial(n, k) << endl;
return 0;
}
Comments
Post a Comment