Answer to Question #275054 in C++ for Ayush

Question #275054

consider an array MARKS [20] [5] which stores the marks obtained by 20 students in 5 subjects. now write a program.


(a.) find the average marks obtained in each subject.


(b.)find the average marks obtained by every student


(c.) find the number of students who have scored below 50 in their average.


(d.) display the scores obtained by every student.


1
Expert's answer
2021-12-03T12:34:47-0500
#include <iostream>


using namespace std;


int main()
{
    int students[20][5], below50 = 0;
    double averageMark;
    for (int i = 0; i < 20; i++) {
        double foo = 0;
        for (int j = 0; j < 5; j++) {
            cin >> students[i][j];
            foo += students[i][j];
            if (students[i][j] < 50) below50++;
        }
        foo/=5;
        cout << "Student " << i << " average " << foo << '\n';
    }
    cout << "Below 50: " << below50 << '\n';
    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