AN SET1 Q2
Problem Statement
You are requested to develop a module for University Management System. The task is to record marks(int type) obtained by students of a particular class in Mid-Term exams conducted for 50 marks for various courses and to generate reports based on that. Row corresponds to student and column corresponds to course. Each row contains the details of marks obtained by a student for different courses and each column contains marks obtained by all students in a course. Your program should perform the following operations,
Get the number of students and number of courses as input, followed by the option number. The following are the different options:
Print the input array values in matrix format.
Calculate the average mark(int type) obtained for each course.
Display the highest average mark among different courses.
Display the course number with highest average mark.
Input Format
Get the number of students and number of courses in separate lines. The third line contains the 2D array values(row-wise). The fourth line contains the option number.
Output Format
For option1, print the matrix. For option 2, display the average marks of various courses in separate lines. For option 3, display the highest average mark among different courses in the new line. For option 4, display the course number that has the highest average mark in a new line. Note: The course number starts from 1.
Sample Input1
3
3
32 33 44 41 25 30 39 22 18
1
Sample Output1
32 33 44
41 25 30
39 22 18
Sample Input2
3
3
32 33 44 41 25 30 39 22 18
2
Sample Output2
37
26
30
Explanation - for understanding purpose only
The average marks of first course is 37, for second course is 26 and for third course is 30. These values are printed in separate lines.
Sample Input3
3
3
32 33 44 41 25 30 39 22 18
3
Sample Output3
37
Explanation - for understanding purpose only
The highest average mark among three courses is 37.
Sample Input4
3
3
32 33 44 41 25 30 39 22 18
4
Sample Output4
1
Explanation - for understanding purpose only
The first course has the highest average mark. Note: The course number starts from 1.
Comments