Answer:
This program is written in C++. The explanation of the code is given below in the explanation section.
Explanation:
#include <iostream>
using namespace std;
//factorial calculation
int fact(int n) {
if (n == 0 || n == 1)
return 1;
else
return n * fact(n - 1);
}
int main() {
int n, r, comb; /* n represent number of people (population), r represent the number of selection from population and combination represent number of ways or combination */
cout<<"Enter n : ";// prompt user to enter population i.e. total number of people
cin>>n;//store into n
cout<<"\nEnter r : ";//prompt user to enter number of selection from population
cin>>r;
comb = fact(n) / (fact(r) * fact(n-r));// calcuate combination- number of differnt ways to form a committe
cout << "\nCombination : " << comb; //show the result
return 0;
}