简答题:下列给定程序中,函数proc()的功能是:根据整型形參n的值,计算如下公式的值。t=i-1/(2*2)-1/(3*3)-

  • 题目分类:C语言
  • 题目类型:简答题
  • 查看权限:VIP
题目内容:
下列给定程序中,函数proc()的功能是:根据整型形參n的值,计算如下公式的值。
t=i-1/(2*2)-1/(3*3)-…-1/(n*n)
例如.当n=7时。t=0.188203。
请修改函数proc()中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h2>
#include<eonio.h>
#include<stdio.h>
double proc(int n)
{double y=1.0;
inl i;
//****found****
for(i=2;i<n;i++)
//****found****
y-=1/(i*i):
telurn(y);
}
void main()
{ int n=7:
system(”CLS”):
print[(”\nThe result is%lf\n”,proe(n))。
1
参考答案:
答案解析:

请编写函数proc(),该函数的功能是:将放在字符串数组中的M个字符串(每串的长度不超过N),按顺序合并组成一个新的字符

请编写函数proc(),该函数的功能是:将放在字符串数组中的M个字符串(每串的长度不超过N),按顺序合并组成一个新的字符串。例如,若字符串数组中的M个字符串为

查看答案

What kind of film does the speaker like?

What kind of film does the speaker like?A.action films B.humorous films C.horro

查看答案

You can get help by visiting KellyAutoSpares' website.

You can get help by visiting KellyAutoSpares' website.A.Right B.Wrong C.Doesn't

查看答案

Jan Whittaker has a box of faulty goods which a shop has se

Jan Whittaker has a box of faulty goods which a shop has sent back.

查看答案