[说明] 编写一个函数,输入为偶数时,调用函数求1/2+/+…+1/n,当输入n为奇数时,调用函数1/1+1/3+…+1/n (利用指针函数)。[函数] #include "stdio. h", main() { float peven (),podd (),dcall (); float sum; int n; while (1) { scanf("%d",&n); if (n>1) break; } if(n%2==0) { printf("Even="): (1); } else { pfinff("Odd="); (2) ; } printf("%f",sum); } float peven (int n) { float s; int i s=1; for(i=2;i<=n;i+=2) (3) ; return (s); } float podd (n) int n; { float s; int i; s=0; for(i=1 i<=n;i+=2) (4) ; return (s); }float dcall(fp,n)float (*fp) ();int n;{float s;(5) ;returu (s);}
参考答案:(1)array+10 (2)array+1 (3)*p>*max (4)k=*max (5)*p=array[0]