C语言:m个人的成绩存放在score数组中,请编写函数fun,它的功能是:将低于平均分的人数作为函数值返回,将低于平均分的分数放在below所指的数组中。

#include <conio.h>
#include <stdio.h>
#include <string.h>

/*
	1.m个人的成绩存放在score数组中,请编写函数fun,它的功能是:将低于平均分的人数作为函数值返回,将低于平均分的分数放在below所指的数组中。
	例如,当score数组中的数据为10、20、30、40、50、60、70、80、90时,函数返回的人数应该是4,below中的数据应为10、20、30、40。
	注意:部分源程序给出如下。
	请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
	#include <conio.h>
	#include <stdio.h>
	#include <string.h>
	
	int fun(int score[],int m, int below[])
	{
		
	}
	main()
	{
	    int i,n,below[9];
	    int score[9]={10,20,30,40,50,60,70,80,90};
	    clrscr();
	    n=fun(score,9,below);
	    printf("\nBelow the average score are :");
	    for(i=0;i<n;i++) 
	        printf("%d ",below[i]);
	}
*/

int fun(int score[],int m, int below[])
{
	
	float sum=0,ave=0;		
	int i, n=0;//n: 低于平均分的人数,返回值 
	
	for(i=0;i<9;i++){
		sum+=score[i];
	} 
	
	ave=su
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值