例如:求组合数C(A,B) = A!/( (A-B)! * B! )
int jie_cheng( int )
void main( )
{
int a = 0,b = 0 , c = 0
scanf("%d %d",&a,&b)
c = jie_cheng(a) / (jie_cheng(a-b)*jiecheng(b))
printf("Zu he shu C is: %d\n", c)
}
int jie_cheng(int num)
{
if( num == 1)
return 1
else
return num*jie_cheng(num-1)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)