资源描述:
《c语言作业101页 文档》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、(5)#includelongfib(intn){longf;if(n==0
2、
3、n==1){if(n==0)f=0;elsef=1;}elsef=fib(n-1)+fib(n-2);returnf;}main(){longy;intn;scanf("%d",&n);y=fib(n);printf("%ld",y);}00Pressanykeytocontinue11Pressanykeytocontinue821Pressanykeytocontinue(6)#includelongfac(intn){longf;if(n==1)f=1;els
4、ef=n*fac(n-1);returnf;}longcomb(intn,intm){intt=0;longc;t=m+n;c=fac(t)+fac(n);returnc;}main(){longc;intn,m;scanf("%d,%d",&n,&m);c=comb(n,m);printf("%ld",c);}2,18Pressanykeytocontinue(10)#includedoublefac(doublen){doublef;if(n==0)f=1;elsef=n*fac(n-1);returnf;}doublefab(doublex,doublen
5、){doublet=1;doublei=0;if(i==0)return1;elsefor(i=1;i<=n;i++)t=t*x;returnt;}doublefad(doublen){doubleg;if(n==0)g=1;elseg=-1*fad(n-1);returng;}doublecomb(doublex,doublen){doublec;c=fad(n)*fab(2*n)/fac(2*n);returnc;}doublecombl(doublex,doublen){doublee;e=comb(x,n)/(combl(x+2.3)+combl(x-3.2,n+3))r
6、eturne;}main(){doublex,n,e;scanf("%f,%f",&x,&n);e=combl(x,n);printf("%f",e);}(8)#includedoublefac(doublen){doublef;if(n==0)f=1;elsef=n*fac(n-1);returnf;}doublefab(doublex,doublen){doublet=1;doublei=0;if(i==0)return1;elsefor(i=1;i<=n;i++)t=t*x;returnt;}doublefad(doublen){doubleg;if(n=
7、=0)g=1;elseg=-1*fad(n-1);returng;}doublecomb(doublex,doublen){doublec;c=fad(n)*fab(2*n)/fac(2*n);returnc;}doublecombl(doublex,doublen){doublee;e=comb(x,n)/(combl(x+2.3)+combl(x-3.2,n+3))returne;}main(){doublex,n,e;scanf("%f,%f",&x,&n);e=combl(x,n);printf("%f",e);}