#include <iostream>
using namespace std;
void main()
{
/* table[][0] - student's id, table[][1..6] - marks*/
int stud_id, i = 0;
float avg = 0;
int table[50][6] = {121, 4,5,3,3,5,
122, 3,3,4,3,4,
123, 5,5,5,4,4,
124, 5,4,3,4,5,
125, 3,3,3,3,3,
126, 4,3,4,3,4,
127, 5,3,2,3,4,
128, 5,5,5,5,3};
cout << "Enter the student's ID: ";
cin >> stud_id;
while(table[i][0] != stud_id)
i++;
for(int j = 1; j < 6; j++)
avg += table[i][j];
avg = avg/5;
cout << "Average is: " << avg << endl;
}
Comments
Leave a comment