/*
开发者:慢蜗牛 开发时间:2020.5.28
程序功能:开发公式Cnm
*/
#include<stdio.h>
long fact_1(int m);
long fact_2(int n, int m);
long fact_1(int m) //求Cnm公示的分母
{
int a = m;
for (int i= m - 1; i > 0; i--)
a = a * i;
return a;
}
long fact_2(int n, int m)//求求Cnm公示的分子
{
int a = n;
for (int i = n - 1; i > 0; i--)
{
a = a * i;
m = m - 2;
if (m == 0) break;
else continue;
}
return a;
}
void main()
{
int m, n;
scanf_s("%d, %d", &m, &n);
while (m < 0 || n < 0)//控制n, m为正整数
{
printf(" input error, please re-enter:\n");
scanf_s("%d, %d", &m, &n);
}
int c = fact_2(n, m) / fact_1(m);// 引用函数
printf("%d", c);
}