大奖赛评委问题

来源:百度知道 编辑:UC知道 时间:2024/05/31 06:31:10
比如说有10个评委找出与平均分最近和最远的评委的号
比说是从1到10号
如何在C语言中确定这个值呢
如a[i] i的这个值,感谢

本题一个完整的c程序如下,在win-tc和Dev-c++下调试通过.
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>

main()
{
int integer,i,m,n,max,min,sum;
max=-32768;/*设为整形数值的最小值*/
min=32767;/*设为整形数值的最小值*/
sum=0;
printf("Please input 10 numbers one by one:\n");
for(i=1;i<=10;i++)
{printf("Input number%d=",i);
scanf("%d",&integer);
sum+=integer;
if(integer>max)
{ max=integer;
m=i;/*这里保存了i值*/
}
if(integer<min)
{ min=integer;
n=i;/*这里保存了i值*/
}
}
printf("\nThe canceled max score:%d\tthe number of the judge:%d\n",max,m);
printf("The canceled min score:%d\tthe number of the judge:%d\n",min,n);
printf("Average score is:%f&