Problem 3.18
A class of n students take an annual examination in m subject. Write a program to rea
ned by each student in various subjects and to compute and print the total marks obtained by
obtained by each stude
each of them.
Answers
Explanation:
/* Write a C Program class of n students take an annual examination in m subjects. A program to read the marks obtained by each student in various subjects and to compute and print the total marks obtained by each of them. */
=======================================================================
#include<stdio.h>
#include<conio.h>
#define FIRST 360
# define SECOND 240
void main()
{
int n, m, i, j, roll number, marks, total;
printf(“Enter number of students and subjects”);
scanf(“%d%d”, &n,&m);
printf(“\n”);
for(i=1; i<=n; ++i)
{
printf(“Enter roll number:”);
scanf(“%d”, &roll_number);
total=0;
printf(“Enter marks of %d subjects for ROLL NO”, m, roll number);
for(j=1; j<=m; j++)
{
scanf(“%d”, &marks);
total=total+marks;
}
printf(“TOTAL MARKS =%d”, total);
if(total>=FIRST)
printf(“(First division)”);
else if (total>=SECOND)
printf(“(Second division)”);
else
printf(“(***FAIL***)”);
}
}
Output:
======
Enter number of students and subjects
3 6
Enter roll_number: 8701
Enter marks of 6 subjects for ROLL NO 8701
81 75 83 45 61 59
TOTAL MARKS =404 (First division)
Enter roll_number:8702
Enter marks of 6 subjects for ROLL NO 8702
51 49 55 47 65 41
TOTAL MARKS =308(Second division)
Enter roll_number: 8704
40 19 31 47 39 25
TOTAL MARKS=201(*** FAIL ***)
Follow me and mark me as a brainliest
Explanation: