Go: package main

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

var (
	sc = bufio.NewScanner(os.Stdin)
)

func main() {
	for sc.Scan() {
		n, _ := strconv.Atoi(sc.Text())
		scores := make([]int, n, n)
		for i := 0; i < n; i++ {
			sc.Scan()
			scores[i], _ = strconv.Atoi(sc.Text())
		}
		sort.IntSlice(scores).Sort()
		var sum = 0
		for i := 1; i < n-1; i++ {
			sum += scores[i]
		}
		fmt.Println(sum / (n - 2))
	}
}

C++: #include <iostream>
#include <algorithm>
#include <numeric>

#define FOR(i,l,n) for(int i=(l);i<(n);i++)
#define REP(i,n) FOR(i,0,n)
#define MAX_JUDGE 100
using namespace std;

int main(){
  int n,score[MAX_JUDGE];
  while(cin>>n,n){
    REP(i,n)cin>>score[i];
    sort(score,score+n);
    int sum = accumulate(score+1,score+n-1,0);
    cout << sum/(n-2) <<endl;
  }
  return 0;
}

C++: //
//  main.cpp
//  ttt
//
//  Created by ??§?£? ??? on 2015/04/23.
//  Copyright (c) 2015??´ ??§?£? ???. All rights reserved.
//

#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    int n;
    while(cin >> n,n!=0){
    int max;
    int min=1005;
    int sum = 0;
    max = 0;
    int x;
    for(int i = 0;i < n;i = i+1){
        cin >> x;
        sum = sum + x;
        if(x > max){
            max = x;}
        if(x<min)
            min = x;
    }
        cout << (sum-min-max)/(n-2)<< endl;}
    return 0;
}

C++: #include <iostream>

int main()
{

    while(1) {
        int judgeNum = 0;
        int pointSum = 0;
        int maximumPoint = 0;
        int minimumPoint = 1000;

        std::cin >> judgeNum;
        if (judgeNum == 0) {
            break;
        }

        for(int i = 0; i < judgeNum; i++) {
            int point;
            std::cin >> point;
            if(point > maximumPoint) {
                maximumPoint = point;
            } else if (point < minimumPoint) {
                minimumPoint = point;
            }
            pointSum += point;
        }

        int answerSum = pointSum - maximumPoint - minimumPoint;

        std::cout << answerSum / (judgeNum - 2) << std::endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,mx,mn;

  while( cin>>n && n ){
    int sum=0;
    mx = -1;
    mn = 10000;
    for( int i=0,j;i<n;i++ ){
      cin >> j;
      sum +=j;
      if( j>mx ) mx=j;
      else if( j<mn ) mn =j;
    }
    sum = sum - mx -mn;
    cout << sum/(n-2) << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main(){
	int n;
	int a[100];
	cin >> n;
	for (int i = 0; i < n; ++i){
		int m, j = 0;
		while(cin >> m,m){
			a[j] = m;
			j++;
		}
		sort(a,a+j+1);
		int sum = 0;
		for (int k = 1; k < j; ++k){
			sum += a[k];
		}
		cout << (sum / j-1) << endl;
	}
	return -;
}

C++: #include "bits/stdc++.h"
using namespace std;

int main() {
	while (true) {
		int n;
		cin >> n;

		if (n == 0) break;

		vector<int> score(n);

		for (int i = 0; i < n; i++) {
			cin >> score.at(i);
		}

		sort(score.begin(), score.end());

		int sum = 0;

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

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

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <numeric>

using namespace std;

int main()
{
	for (int i = 4; i > 1; i++) {
		int n;
		cin >> n;
		if (n == 0) break;
		vector<int> s(n);
		for (int b = 0; b < n; b++) {
			cin >> s[b];

		}
		
		int sum = 0;      // ????¨?????±????????????°
		for (int t = 0; t < n; t++) {
			// ??¨??¨???????´?????????????
			sum += s[t];    // ????¨??????????
		}
		
		int ma;
		int mi;
		ma = *max_element(s.begin(), s.end());
		mi = *min_element(s.begin(), s.end());
		
		double score;
		score = (sum - ma - mi) / (n - 2);
		cout << score << endl;
		

	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
int n;
while(cin >> n) {
if(n == 0) break;
vector<int> a(n);
for(int i=0; i<n; i++) {
cin >> a[i];
}

sort(a.begin(), a.end());

int sum = 0;
for(int i=0; i<n; i++) {
if(i!=0 && i!=n-1) sum += a[i];
}

cout << sum / (n-2) << endl;
}
return 0;
}

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

int main() {
  int n;
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    int k;
    int maxn = -1;
    int minn = 1000000;
    int sum = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &k);
      maxn = max(maxn, k);
      minn = min(minn, k);
      sum += k;
    }
    printf("%d\n", (sum - maxn - minn) / (n - 2));
  }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
    int n;
    vector<int> vi;
    while (cin >> n, n) {
        vi.clear();
        for (int i = 0; i < n; i++) {
            int s;
            cin >> s;
            vi.push_back(s);
        }
        sort(vi.begin(), vi.end());
        cout << accumulate(vi.begin()+1, vi.end()-1, 0) / (n-2) << endl;
    }
    return 0;
}

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

int main(){
    int a,n;
    for(;;){
        vector<int> num;
        cin>>n;
        if(n==0) break;
        for(int i = 0; i < n; i++){
            cin>>a;
            num.push_back(a);
        }
        sort(num.begin(), num.end());
        num.erase(num.begin());
         num.pop_back();
        int sum=0;
        for(int x : num){
            sum+=x;
        }
        sum/=num.size();
        cout<<sum<<endl;
    }
    return 0;
}

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

int main() {
  int n, s;
  int v[110];

  while (cin >> n && n > 0) {
    int sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> s;
      sum += s;
      v[i] = s;
    }
    sort(v, v + n);
    sum -= v[0];
    sum -= v[n-1];
    cout << sum/(n-2) << endl;
  }

  return 0;
}

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

int main() {
	while(1){
		int n,sum=0;
		cin>>n;
		if(n==0)
			break;
		int s[n];
		for(int i=1; i<=n; i++)
			cin>>s[i];
		for(int i=1; i<=n; i++){
			int v=s[i];
			if(s[i]<=s[1]){
				s[i]=s[1];
				s[1]=v;
			}
			if(s[i]>=s[n]){
				s[i]=s[n];
				s[n]=v;
			}
		}
		for(int i=2; i<=n-1; i++)
			sum+=s[i];
		cout<<sum/(n-2)<<endl;
	}
			
			
				
	
	return 0;
}

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

int main() {
	int n, i, p[100], t = 0;
	int max = 0, min = 1000, maxi, mini;
	cin >> n;
	
	for (i = 0; i < n; i++) {
		cin >> p[i];
	}

	for (i = 0; i < n; i++) {
		t += p[i];

		if (p[i] > max) {
			maxi = i;
			max = p[i];
		}

		if (p[i] < min) {
			mini = i;
			min = p[i];
		}
	}

	cout << (t - p[maxi] - p[mini]) / (n - 2) << endl;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
 
int main() {
    int n, data;
    while(1) {
        scanf("%d", &n);
        if (n == 0) break;
        int sum=0, max=0, min=1001;
        for (int i=0; i<n; i++) {
            scanf("%d", &data);
            sum+=data;
            if (max < data) max=data;
            if (data < min) min=data;
        }
        printf("%d\n", (sum-max-min)/(n-2));
    }
}

C++: #include<iostream>
#include<cstdio>

using namespace std;

int main()
{

  while(1)
  {
	 int n;

	 cin >> n;
 
	 if(n == 0)break;

	 int Max = 0; 
	 int Min = 1001;
	 int Sum = 0;

	 for(int i = 0;i < n;i++)
	 {
	   int tmp;
	   cin >> tmp;
	   Sum += tmp;
	   Max = max(tmp,Max);
	   Min = min(tmp,Min);
	 }

	 Sum = Sum - Max - Min; 

	 cout << Sum/(n-2) << endl;
  }

  return 0;
}