Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		num := nextInt(sc)
		if num == 0 {
			break
		}

		score_list := []int{}
		for i := 0; i < num; i++ {
			score_list = append(score_list, nextInt(sc))
		}
		// 得点リストをソートした後、最低点と最高点を取り除く(3 ≤ n ≤ 100)
		sort.Sort(sort.IntSlice(score_list))
		score_list = score_list[1 : len(score_list)-1]
		// 得点リストの得点を合計し、スライスの個数で割って平均点を出す
		sum := 0
		for _, score := range score_list {
			sum += score
		}
		fmt.Println(sum / len(score_list))
	}
}

C++: #include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define rFOR(i, a, b) for(int i=b-1; i>=a; i--)
#define MAX 20
using namespace std;

int main(void){
  while(true){
    int n;  cin >> n;
    if(n==0)  break;
    int s[MAX], sum=0;
    rep(i, n) cin >> s[i];
    sort(s, s+n);
    FOR(i, 1, n-1)  sum += s[i];
    cout << sum/(n-2) << endl;

  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main( void )
{
  while( 1 ){
    int n, a;
    cin >> n;
    if( n == 0 ) break;
    int minv = 1001;
    int maxv = -1;
    int s = 0;
    for( int i=0; i<n; i++ ){
      cin >> a;
      s += a;
      minv = min( minv, a );
      maxv = max( maxv, a );
    }
    cout << (s - minv - maxv) / (n - 2) << endl;
  }
}

C++: #include<iostream>

using namespace std;

int main () {

  while (true){

    int n;
    int i;
    int s = 0;
    int mi = 0;
    int ma = 0;
    cin >> n;

    if (n == 0)
      break;
??????
??????int p[100];

    for (i=0,i<n,i++){
      cin >> p[i];

      if (p[i] < mi)
        mi << p[i];

      if (p[i] > ma)
        ma << p[i];

      s += p[i];

    }

    cout << (s - mi - ma) / (n-2);

  }

  return 0;

}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vll = vector<ll>;
using vvll = vector<vll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using plli = pair<ll, int>;
using vplli = vector<pair<ll, int>>;
using pllll = pair<ll, ll>;
using vpllll = vector<pair<ll, ll>>;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i - 1; i >= (ll)end_i; i--)

long long INF = 1LL << 60;
int main()
{
    while (true)
    {
        int n;
        cin >> n;
        if (n == 0)
            break;
        ll res = 0;
        int max = -(1 << 30), min = 1 << 30;
        rep(i, 0, n)
        {
            int s;
            cin >> s;
            res += s;
            chmax(max, s);
            chmin(min, s);
        }
        cout << (res - max - min) / (n - 2) << endl;
    }
    return 0;
}

C++: #include<stdio.h>

void QSort(int x[ ], int left, int right);
void Swap(int x[ ], int i, int j);

void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                   
    j = right;                  

    pivot = x[(left + right) / 2];
    while (1) {                   

        while (x[i] < pivot)      
            i++;                  

        while (pivot < x[j])      
            j--;                  
        if (i >= j)               
            break;                

        Swap(x, i, j);            
        i++;                      
        j--;
    }

    if (left < i - 1)              
        QSort(x, left, i - 1);     
    if (j + 1 <  right)            
				QSort(x, j + 1, right);    
		}

void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(void)
{
	int i;
	int j;
	int k;
	int n;
	int d[20];
	int p[100];
	int sum;
	int ave;
	
	while(1){

		scanf("%d",&n);
		if(n==0) 
			break;
			
		j = 0;
		for(i=0;i<n;i++){
		scanf("%d",&p[i]);
		}

		QSort(p,0,n-1);	
	
		sum = 0;
		for(i=1;i<n-1;i++)
			sum += p[i];
	
			
			d[j] = sum / (n-2);
			j++;
	}
	
	for(k=0;k<j;k++)
		printf("%d",d[k]);
	
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	while(cin>>n){
		if(n==0) return 0;

		vector<int> V;
		for(int i=0;i<n;i++){
			int t;
			cin>>t;
			V.push_back(t);
		}
		sort(V.begin(),V.end());

		int ans=0;
		for(int i=1;i<V.size()-1;i++)
			ans+=V[i];
		cout<<ans/n<<endl;

	}
}

C++: #include  <stdio.h>

int main(void){

  int size=0;
  int max=0;
  int min=1000;
  int num=0;
  int sum=0;
  while(1){

    min=1000;
    max=0;
    sum=0;
    scanf("%d",&size);
    if(size==0){
      break;
    }
    for(int i=0;i<size;i++){
      scanf("%d",&num);
      sum+=num;
  //    printf("::%d\n",sum);
      if(num<min){
        min=num;
      }
      if(num>max){
        max=num;
      }
    }
//    printf("%d %d",min,max);
    sum=((sum-max)-min)/(size-2);
    printf("%d\n",sum);
}
return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
  int a[101];
  int b[20];
  int n = 0;
  int i = 0;
  int max = 0;
  int min = 1000;
  int sum = 0;
  int counter = 0;
  while(1){
    max = 0;
    min = 1000;
    sum = 0;
    cin >> n;
    if(n==0) break;
    for(i=0;i<n;i++){
      cin >> a[i];
      if(max <= a[i]) max = a[i];
      if(min >= a[i]) min = a[i];
      sum += a[i];
    }
    b[counter] = (sum - max - min) / (n - 2);
    counter++;
  }
  for(i=0;i<counter;i++){
    cout << b[i] << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

int main(){

  while(1){

    int n,sum,ave;
  cin >> n;
  vector<int>vec(n);
  sum=0;
  ave=0;

  if(n==0)break;

  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());

  for(int i=1;i<n-1;i++){
    sum+=vec.at(i);
  }

  ave = sum/(n-2);
  cout << ave <<endl;
  }


}

C++: #include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
    int n;
    int x[21];
    while(1){
        int S=0;
        cin>>n;
        if(n==0){
            break;
        }
        for(int i=0;i<n;i++){
            cin>>x[i];
        }    
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                if(x[i] < x[j]){
                    int temp = x[i];
                    x[i] = x[j];
                    x[j] = temp;
                }
            }
        }
        for(int i=1;i<n-1;i++){
            S=S+x[i];
        }
        int A=0;
        A=S/(n-2);
        cout<<A<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
  for(;;){
    int n;
    cin >> n;
    if(n==0) break;
    vector<int> v(n);
    for(int i=0; i<n; i++){
      cin >> v[i];
    }
    sort(v.begin(),v.end());
    int ret = 0;
    for(int i=1; i<v.size()-1; i++){
      ret += v[i];
    }
    ret /= n-2;
    cout << ret << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0)
		break;
		int x[n],ma=0,mi=0,ans=0;
		for(int i=0;i<n;i++){
			cin>>x[i];
			ans+=x[i];
			if(i==0)
			mi=x[i];
			ma=max(x[i],ma);
			mi=min(x[i],mi);
		}
		cout<<(ans-(ma+mi))/(n-2)<<endl;
	}
return 0;
}