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.
#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;
}
Comments
Leave a comment