- #include <iostream>
- using namespace std;
- long fac(int n) //求n 的阶乘
- {
- int st_n = 1;
- while (n > 0)
- {
- st_n = n*st_n;
- --n;
- }
- return st_n;
- }
- int main()
- {
- int m, n, C_mn;
- cout <<"请输入要求组合数m,n的值:"<< endl;
- cin >> m >> n;
- C_mn = fac(m)/(fac(n) * fac(m-n));
- cout << C_mn << endl;
- system("PAUSE");
- return 0;
- }
实验报告 《2》2
