网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
以下函数的功能是【18】。
float av(a, n)
float a[];
int n;
{ int i; float s;
for(i=0, s=0; ireturn s/n;}
参考答案
更多 “ 以下函数的功能是【18】。float av(a, n)float a[];int n;{ int i; float s;for(i=0, s=0; ireturn s/n;} ” 相关考题
考题
函数 void fun(float *sn, int n)的功能是:根据以下公式计算S,计算结果通过形参指针sn传回;n通过形参传入,n的值大于等于0。请填空。void fun( float *sn, int n){ float s=0.0, w, f=-1.0;int i=0;for(i=0; i=n; i++){ f=( )* f;w=f/(2*i+1);s+=w; }( )=s;}
考题
以下函数的功能是删除字符串s中的所有数字字符,请填空。void dele(char *s){ int n=0,i; for(i=0;s[i];i++) if() s[n++]=s[i]; s[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 is=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);}
考题
以下函数的功能是删除字符串s中的所有数字字符,请填空。void dele(char *s){ int n=0,i;for(i=0; s[i];i++)if()s[n++]=s[i];s[n]=;}
考题
有以下程序includevoid fun(float* p1,int n1,float,*p2,int n2,float* s){ int i;s=(
有以下程序 #include<stdio.h> void fun(float * p1,int n1,float,*p2,int n2,float * s) { int i; s=(float *)calloc(1,sizeof(float)); *s=0; for(i=0;i<n1;i++) *s+=*p1++; for(i=0;i<n2;i++) *s+=*p2++; } main() { float a[2]={1.1,2.2},b[3]={10.0,20.0,30.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是( )A.60B.3.3C.63.3D.1.1
考题
7、以下程序的输出结果是()。 #include<stdio.h> double f(int n) { int i; double s=0; for(i=1;i<=n;i++) s+=1/i; return s; } void main() { int i,m=3; float a=0.0; for(i=0;i<=m;i++) a=a+f(i); printf("%f\n",a); }A.5.5000000B.3.000000C.4.000000D.8.25
考题
【填空题】下面函数的功能是根据公式s=l-1/3+1/5-1/7+...+(-1n )/(2*n+1)计算s,计算结果通过形参指针sn传回。n通过形参传入,n的值大于等于0。请填空使程序完整、正确。 void fun(float *sn,int n) { float s=0.0,w,f=-1.0;int i=0; for(i=0;i<=n;i++) { f=(1____)=s; }
考题
函数fun的功能是:根据以下公式计算并返回S,n通过形参传入,n的值大于等于0。划线处应填________。 S=1-1/3+1/5-1/7+…1/(2*n-1) float fun(int n) { float s=0.0,w,t,f=-1.0; int i; for(i=0;i<n;i++) { f=-f; w=f/(2*i+1); s+=w; } ____________; }
热门标签
最新试卷
![瑞牛题库 章节练习 历年真题 模拟试卷](http://assets.51tk.com/51_sidebar_right_index.jpg)