题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-13 11:51:23

[填空题]下面程序通过函数average( )计算数组中各元素的平均值。 float average(______,int n)/*第一空*/ {int i; float avg=0.0; for(i=0;i<n;i++) avg=avg+______;/*第二空*/ avg=______;/*第三空*/ return avg; } main( ) {int i,a[5]={2,4,6,8,10); float mean; mean=average(a,5); printf("%f/n",mean); }

更多"下面程序通过函数average( )计算数组中各元素的平均值。 "的相关试题:

[填空题]下面的程序通过函数average计算数组中各元素的平均值,请填空。
float avetage(int * pa,int n)
   int i;
    float avg=0.0;
    for(i=0;i<n;i+ +);
     avg=avg+______;avg=______;
    return avg;
  
  main( )
   int i,a[5]=2,4,6,8,10,;
    float mean;
    prinf("% mean=% f/n",mean);

[填空题]下面是一个JavaApplet程序,请将程序补充完整使它的功能为计算数组各元素的平均值。
import java.applet.Applet;
import java.awt.*;
public class Exam extends Applet
public void paint(Graphics g)
int a[ ]=1,3,5,7,9,10;
int total=0;
float ave;
for(int i=0; i<A.length;i++)
total+=a[i];
ave=total/
g.drawstring("ave="+ave,30,60);


[填空题]下面是一个Java Applet程序,请将程序补充完整使它的功能为计算数组各元素的平均值。 import java.applet.Applet; import java.awt.*; public class Exam extends Applet{ public void paint(Graphics g){ int a[]={1,3,5,7,9,10}; int total=0; float ave; for(int i=0;i<A.length;i++) total+=a[i]; ave=total 【13】 ; g.drawstring("ave="+ave,30,60); } }
[填空题]下面是一个Java Applet程序,请将程序补充完整使它的功能为计算数组各元素的平均值。
import java.applet.Applet;
import java.awt.*;
public class Exam extends Applet
public void paint(Graphics g)
int a[]=1,3,5,7,9,10;
int total=0;
float ave;
for(int i=0;i<A.length;i++)
total+=a[i];
ave=total 【13】
g.drawstring("ave="+ave,30,60);


[填空题]下列给定程序中,函数fun( )的功能是:给定n个实数,输出平均值,并统计平均值以上(含平均值)的实数个数。例如, n=8时,输入193.199,195.673,195.757,196.051,196.092, 196.596,196.579,196.763,所得平均值为195.838745,在平均值以上的实数个数应为5。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <conio.h> #include <stdio.h> int fun(float x[], int n) /***************found*******************/ iht j, c=0;float xa=0.0; for (j=0; j<n;.j++) xa+=x[j]/n; printf("ave=%f/n",xa); for (j=0; j<n;j++) if(x[j]>=xa) c++; returnc; } main( ) {float x[l00]={ 193.199,195.673,195.757, 196.051,196.092,196.596, 196.579,196.763}; clrscr ( ); printf("%d/n",fun (x,8)); }
[填空题]下列是一个Java Applet程序,填空使它的功能为计算数组各元素和的平均值。 import java applet. * ; import java awt. * ; public class Testvv extends Applet { pubfic void paint(Graphics g) { int a[ ]= { 1,3,5,7,9,10 }; double total=0.0,ave=0.0; for(int i=0;i<a.length;i++) total+=a[i]; ave=total/ 【 】; g.drawstring("ave="+ave,30,60); } }
[填空题]下列是一个Java Applet程序,填空使它的功能为计算数组各元素和的平均值。 import java applet.*; import java awt.*; public class Testvv extends Applet { public void paint(Graphics g) { int a[ ]={1,3,5,7,9,10}; double total=0.0, ave=0.0; for(int i=0;i<a.length;i++) total+=a[i]; ave=total/ 【9】 ; g. drawstring ( "ave="+ave, 30, 60; ) } }
[填空题]下列是一个Java Applet程序,填空使它的功能为计算数组各元素和的平均值。
import java applet.*;
import java awt.*;.
public class Testvv extends Applet

public void paint(Graphics g)

int a []=1,3,5,7,9,10 ;
double total=0.0,ave=0.0;
for(int i=0;i<a.length;i++)
total+=a[i];
ave=total/______;
g.drawString("ave="+ave,30,60);
[填空题]请补充main函数。该函数的功能是:求1~100(不包括100)以内所有素数的平均值。 程序运行后的结果为42.40。 注意:部分源程序给出如下. 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> main( ) { int i, j, n=0,flag; float aver=0; clrscr( ); for(j=2;j<100;i++) { flag=1; for(i=2;i<j;i++) if( 【1】 ) { flag=0; break; } if( 【2】 ) { n++; aver+=j; } } printf("/n/n average=%4.2f", 【3】 ); }
[填空题]请补充main函数。该函数的功能是:求1~100(不包括100)以内所有素数的平均值。
程序运行后的结果为42.40。
注意:部分源程序给出如下.
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
main( )

int i, j, n=0,flag;
float aver=0;
clrscr( );
for(j=2;j<100;i++)

flag=1;
for(i=2;i<j;i++)
if( 【1】 )

flag=0;
break;

if( 【2】 )

n++;
aver+=j;


printf("/n/n average=%4.2f", 【3】 );

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码