数字超出界限了,唉搞了这么久终于搞出来只要把类型变一下就局消行,其他不用改换成float或者double类型,最好桐老知是double,因为阶乘这东西可是天文数字啊望采纳# include int n;void main(){ float fac (float a,float b); float x,y; float sum; printf("please input the step number:"); scanf("含胡%d",&n); sum=fac(x,y); printf("%f\n",sum);}float fac (float a,float b){ float comb(float j); float w=0; for (a=0;a<=n;a++) { for (b=0;b<=n/2;b++) if (a+2*b==n) { w+=comb(a+b)/(comb(a)*comb(b)); } } return w; }float comb (float j){ if (0==j) return 1; else return (j*comb(j-1));}
标签:找错
版权声明:文章由 知识问问 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.zhshwenwen.com/article/332772.html