AN SET1 Q2


Submit solution

Points: 15 (partial)
Time limit: 8.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
C

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:

  1. Print the input array values in matrix format.

  2. Calculate the average mark(int type) obtained for each course.

  3. Display the highest average mark among different courses.

  4. 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

There are no comments at the moment.