课堂实验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-21 09:16  执于一念  阅读(124)  评论(0编辑  收藏  举报