实验 5-2

#include<stdio.h>
int main()
{
    int m,n;
    float result,sum;
    float fact(int n);
    printf("enter m and n:");
    scanf("%d%d",&m,&n);
    sum=fact(m-n);
    result=fact(m)/(fact(n)*sum);
    printf("result=%.0f\n",result);
    return 0;
}
float fact(int n)
{
    int i;
    float result;
    result=1;
    for(i=1;i<=n;i++){
        result=result*i;
    }
    return result;
}

 

posted @ 2013-10-28 08:25  傻子疯子捏子  阅读(106)  评论(0编辑  收藏  举报