2-18求组合数

#include<stdio.h>
double fact(int n);
int main(void){
int m,n;
double C;
printf("n大于m Enter m:");
scanf("%d",&m);
printf("n大于m Enter n:");
scanf("%d",&n);
C=fact(n)/(fact(m)*fact(n-m));
printf("C=%lf",C);
return 0;
}

double fact(int n){
int i;
double product;
product=1;
for(i=1;i<=n;i++){
product=product*i;
}
return product;
}

posted @ 2023-12-03 17:19  Grit_Doyle  阅读(22)  评论(0)    收藏  举报