#include<iostream.h>
#include<stdio.h>
#include<conio.h>
struct student
{
int adm_no;
char name[30];
float marks[5];
};
void main()
{
student stud[2];
double total[2],avg_marks[2];
int i,j;
for(i=0;i<2;i++)
{
cout<<"Enter admission no.: ";
cin>>stud[i].adm_no;
cout<<"Enter name of student: ";
gets(stud[i].name);
cout<<"Enter marks in the five subjects:"<<endl;
for(j=0;j<5;j++)
{
cout<<"Percentage marks in subject no."<<j+1<<": ";
cin>>stud[i].marks[j];
total[i]= total[i] + stud[i].marks[j];
}
avg_marks[i]= total[i] / 5;
cout<<endl;
}
cout<<"\n*******************************************\n\n";
for(i=0;i<2;i++)
{
cout<<"Admission no.: "<<stud[i].adm_no<<endl;
cout<<"Name of student: ";
puts(stud[i].name);
cout<<"Percentage in the five subjects:"<<endl;
for(j=0;j<5;j++)
cout<<"Percentage in subject no."<<j+1<<": "<<stud[i].marks[j]<<endl;
cout<<"Total Marks: "<<total[i]<<"/500"<<endl;
cout<<"Average Marks: "<<avg_marks[i]<<endl;
cout<<"Result: ";
if(avg_marks[i]<40)
cout<<"Fail"<<endl<<endl;
else
cout<<"Pass"<<endl<<endl;
}
cout<<"*******************************************";
getch();
}