## Expert Answer

**Answer:**

#include<iostream>

using namespace std;

long fact(int);//prototype of fact() function

int binomialCoeff(int n,int k) //binomialCoeff() definition starts here

{

int numerator=1,i;

if(n==k) //c(n,n) is 1

return 1;

else if(n==0||n<k) // if n is 0 or n<k, then result is 0

return 0;

else //otherwise

{

for(i=n-k+1;i<=n;i++) // loop starts from (n-k+1) to n

{

numerator=numerator*i;

}

return numerator/fact(k);

}

}

long fact(int n) // function definition of fact()

{

if(n==0||n==1) // if n is 0 or 1 factorial value is 1

return 1;

else

return n*fact(n-1); // recursive call to fact()

}

int main() // main() function definition

{

int n,k,res; //variable declaration

cout<<“Enter the value of n and k in C(n,k):”;//prompts the message

cin>>n>>k;//takes n and k from the keyboard

cout<<“The Value of C(“<<n<<“,”<<k<<“) is “<<binomialCoeff(n,k);; // function call to binomialCoeff() function

return 0;

} //End of main()

**Output:**