编写函数fun( ),函数的功能是:根据以下公式计算s,计算结果作为函数值返回;n通过形参传入。
S=1+1/(1+2)+1/(1+2+3)+…+1/(1+2+3+…+n)
例如:若n的值为11时,函数的值为1.833333。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <string.h>
float fun(int n)

main( )

int n;
float s;
clrscr( );
printf("/nPlease enter N: ");
scanf("%d",&n);
s=fun(n);
printf("The result is:%f/n " , s);

题库:计算机等级考试 类型:简答题 时间:2017-07-03 15:11:48 免费下载:《问答》Word试卷

编写函数fun( ),函数的功能是:根据以下公式计算s,计算结果作为函数值返回;n通过形参传入。
S=1+1/(1+2)+1/(1+2+3)+…+1/(1+2+3+…+n)
例如:若n的值为11时,函数的值为1.833333。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <string.h>
float fun(int n)

main( )

int n;
float s;
clrscr( );
printf("/nPlease enter N: ");
scanf("%d",&n);
s=fun(n);
printf("The result is:%f/n " , s);

编写函数fun( ),函数的功能是:根据以下公式计算s,计算结果作为函数值返回;n通过形参传入。  S=1+1/(1+2)+1/(1+2+3)+…+1/(1+2

本题关键词:功效函数图,风险函数,计数结果,计算基数,数量计算,K值计算公式,计算机数值模拟技术,白细胞计数结果,利润计算基数,疏散人数计算;

微信扫码获取答案解析
下载APP查看答案解析