write a c++ program to input mark scored by students in a class for a subjet and calculate the average mark in the subject
.
correct answer will be marked by brainliest......
Answers
Answer:
#include<iostream.h>
#include<conio.h>
#include<dos.h>
void main ( )
{
struct student
{
int rn ;
int sub[10] ;
};
struct student st[50] ;
int i, j,n,m,total;
float av;
clrscr( );
cout<<"\n Enter the Number of Students in the Class : ";
cin>> n ;
cout<<"\nEnter the Number of Subjects Each Student has Taken : " ;
cin>> m ;
for (i=0;i<n;i++)
{
total = 0 ;
cout<<"\nEnter the Rollno of "<<i+1<<" Student : ";
cin>> st[i].rn;
cout<<"\nEnter the Marks : ";
for (j=0;j<m;j++)
{
cout<<"\nEnter the Marks of "<<j+1 <<" Subject : ";
cin>> st[i ].sub[j ];
total = total + st[i ].sub[j ];
}
av = (float) total / m ;
cout<<"AVERAGE Marks of "<<i+1<<" Student = "<< av;
}
getch();
}