# Practice, find the combination of formula values

Source: Internet
Author: User
The formula for the number of combinations is:

To compile a program, enter the values of M and N to find the number of combinations. It is required to define the function of the factorial and the combination, and the function of the combination number to find the function of the factorial, and in the main () function, it is responsible for the input output and the function of calling the combination number.

```#include <iostream>
using namespace std;
int FAC (int);

int main ()
{
int m,n;
float C;
cout<< "Calculate C (m,n), enter values for M, n" <<endl;
cin>>m>>n;
C=FAC (m)/(FAC (n) *FAC (m-n));
cout<< "Number of combinations" <<c<<endl;
return 0;
}

int FAC (int n)
{
int i,f=1;
for (I=1; i<=n; i++)

f=i*f;
return f;
}
```

Should be careful to determine the size of M, n

```int main ()
{
int m,n;
float C;
cout<< "Calculate C (m,n), enter values for M, n" <<endl;
cin>>m>>n;
if (m>n)
{
C=FAC (m)/(FAC (n) *FAC (m-n));
cout<< "Number of combinations" <<c<<endl;
}
Else cout<< "M should be greater than n" <<endl;
return 0;
}
```

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.