编写函数fun,其功能是:根据以下公式求P的值,结果由函数值带回。m与n为两个正整数且要求m >

日期:2016-05-26 00:17:10 人气:1

编写函数fun,其功能是:根据以下公式求P的值,结果由函数值带回。m与n为两个正整数且要求m >

#include int calc(int n){ if(n==1) return 1; else return calc(n-1)*n; } int fun(int m,int n){ return calc(m)/(calc(n)*calc(m-n)); } int main(){ int m,n; scanf("%d %d",&m,&n); printf("%.6f",fun(m,n)*1.0); return 0; }
    A+
热门评论