第二周实验报告 2-1

来源:互联网 发布:win10蓝牙共享网络 编辑:程序博客网 时间:2024/06/08 02:47
#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;  }  

 
原创粉丝点击