View Code of Problem 612

#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    int a[999],max=-1,min=999,m=0,n=0,sum;
    float s;
    while(cin>>a[0]){
        sum=0;
    for(int i=1;i<6;i++){
        cin>>a[i];
        if(a[i]>max){
            max=a[i];
        m=i;
        }
        if(a[i]<min){
            min=a[i];
            n=i;
        }
    }
    a[m]=a[n]=0;
    for(int i=0;i<6;i++){
        sum+=a[i];
    }
    s=sum/4.0;
    cout<<s<<endl;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 612