You are on page 1of 2

EXPERIMENT NO.

– 10
(Program to read the marks of 10 students in 5 subjects and find average marks and
allot grades.)

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>

struct student
{
char sname[10];
float marks[5];
float total;
float avg;
char grade;
}
s[10];
void main()
{
clrscr();
int I;
for(i=0;i<10;i++)
{
cout<<”enter the name of student”<<i<,”\t”;
get(s[i].sname);
for(int j=0;j<5;j++)
{
cout<<”\n enter the marks in subject”<<j<<”\t”;
cin>>s[i].marks[j];
}
for(j=0;j<5;j++)
{
s[i].total=s[i].total+s[i].marks[j];
}
s[i].avg=s[i].total/5;
cout<<”\n the average of student<<i<<”is:”<<s[i].avg;
if(s[i].avg>90.0)
s[i].grade=’O’;
else if(s[i].avg<90.0&&(s[i].avg>=85.0)
s[i].grade=’A’;
else if(s[i].avg<85&&(s[i].avg>=80.0)
s[i].grade=’B’;
else if(s[i].avg<75&&(s[i].avg>=70.0)
s[i].grade=’C’;
else
s[i].grade=’D’;
cout<<”\n the grade of student”<<i<<s[i].grade;
}
getch{};
}

You might also like