Untitled
unknown
c_cpp
a year ago
650 B
5
Indexable
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double scores[6];
for (int i = 0; i < 6; i++) {
cin >> scores[i];
}
double maxScore = scores[0];
double minScore = scores[0];
double total = 0.0;
for (int i = 0; i < 6; i++) {
if (scores[i] > maxScore) {
maxScore = scores[i];
}
if (scores[i] < minScore) {
minScore = scores[i];
}
total += scores[i];
}
double average = (total - maxScore - minScore) / 4.0;
cout << fixed << setprecision(1) << average << endl;
return 0;
}
Editor is loading...
Leave a Comment