第6章 函数与预处理习题解答 下载本文

return g; }

int main() {

int a,b;

printf(\ scanf(\

printf(\ return 0; }

⑸已知:y?f(x,n)f(x?2.3,n)?f(x?3.2,n?3)

x,n)?1?x22n其中:f(x4nx2!?4!???(?1)(2n)! 当x=5.6,n=7时,求y.

#include

double fun(double x,int n)//计算x的n次方 {

int i;

double y=1.0; for(i=1;i<=n;i++) y=y*x; return y; }

int fact(int n) //计算n! {

long p; int i;

for(i=1,p=1;i<=n;i++) p=p*i; return p; }

double f(double x,int n) //函数f(x,n) {

double y=1; int i;

for(i=1;i<=2*n;i+=1)

y=y+fun(-1,i)*fun(x,2*i)/fact(2*i); return y; }

int main()

n≥0) ({ }

double y;

y=f(5.6,7)/(f(5.6+2.3,7)+f(5.6-3.2,7)); printf(\return 0;