Answer to Question #157774 in C++ for Earl Davis

Question #157774

Store a student’s four exam scores: 95, 87, 90, 89

Calculate and store the sum of those four test score.

Calculate and store the average of these scores.

Display the sum and average as shown below:


OUTPUT:

The sum of your scores is: 361

The average of your scores is: 90.25


1
Expert's answer
2021-01-23T10:19:00-0500
#include <iostream>
using namespace std;
int main () {
    int scores[4] = {95, 87, 90, 89};  
    int total_score = 0;
    double average_score;
    cout << "you scroes: ";
    for (int i = 0; i < 4; i++) {
        cout << scores[i] << " ";
        total_score += scores[i];
    }
    average_score = total_score / 4.0;
    cout << "\nThe sum of your scores is: " << total_score;
    cout << "\nThe average of your scores is: " << average_score;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS