递归求解组合数

 1 #include<stdio.h>
 2 #include<conio.h>
 3 int fun(int m,int n)
 4 {
 5     if(m==n)return 1;
 6     if(n==1)return m;
 7     return fun(m-1,n)+fun(m-1,n-1);
 8 }
 9 int main()
10 {
11     printf("%d\n",fun(7,3));
12     getch();
13     return 0;
14 }

posted @ 2013-05-02 11:04  Please Call me 小强  阅读(227)  评论(0编辑  收藏  举报