Remove the nb version with the highest score and the lowest score

#include<stdio.h>
void main()
{
    
    
	int n;
	float m,s,a,b,v;
	while(scanf("%d",&n)!=EOF)
	{
    
    
		a=0;b=100;s=0;//最小是b,最大是a。
		while(n--)//接收n次
		{
    
    
			scanf("%f",&m);
			if(a<=m) a=m;
			if(b>=m) b=m;//边输入边找出最大最小   输入时的小技巧
			s+=m;
		}
		v=(s-(a+b))/(n-2);
		printf("%.2f\n",v);
	}
}

Guess you like

Origin blog.csdn.net/cwindyc/article/details/107009446