60 477
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #6812 in C++ for rajashekar

Question #6812
A table contains student id's and 5 subject's marks with data we have to find the avg marks of the student , student id as input.
Expert's answer
#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;

}

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions