代码片断(4)(0 位领导批示)

函数使用..求一个数的阶乘
并运算出n!/(m!*(n-m)!)的结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "stdio.h"
#include "math.h"
 
float fac(int k)
{
    float t=1;
    int i;
    for(i=2;i<=k;i++) t*=i;
    return t;
}
 
void main()
{
    float c;
    int m,n;
    scanf("%d%d", &m,&n);
    c=fac(n)/(fac(m)*fac(n-m));
    printf("%f",c);
}

相关文章

分享到新浪微博 推荐到豆瓣 分享到 Google Reader 加入Google书签 嘀咕一下 分享到饭否 分享到做啥 分享到叽歪 分享到鲜果 加入QQ书签 加入百度搜藏 加入雅虎书签 分享到垦一垦

银子曰:还没有领导题词?

请领导指示

验证码 (必须)

Additional comments powered by BackType

随机显示的10篇日志

评论最多的10篇日志

浏览最多的10篇日志