阅读以下说明和C语言函数,将应填入(n)处的字句写在对应栏内。[说明] 编写一个函数,输入为偶数时,
阅读以下说明和C语言函数,将应填入(n)处的字句写在对应栏内。
[说明]
编写一个函数,输入为偶数时,调用函数求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);
}