recent

A program to read the marks obtained by each student in various subjects

A 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>
#define FIRST 360
# define SECOND 240
void main()
{
int n, m, i, j, roll number, marks, total;
printf("Enter number of students and subjects:\n");
scanf("%d%d", &n,&m);
printf("\n");
for(i=1; i<=n; ++i)
{
printf("Enter roll number:\n");
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***)");
}
}
Powered by Blogger.