CPP03 – Write a CPP program to find the maximum marks, average-marks and minimum marks obtained by a study in five papers given

By | October 16, 2018

Write a CPP program to find the maximum marks, average-marks and minimum marks obtained by a study in five papers as given below:

Paper 1            Paper 2            Paper 3            Paper 4            Paper 5

Marks              50                    70                    65                    80                    56

CODE:-

#include<iostream.h>
#include<conio.h>
void main()
{
int i,min,max,avg,sum=0,marks[5]={50,70,65,80,56};
clrscr();
min=max=marks[0];
for(i=0;i<5;i++)
{
if(min>marks[i])
min=marks[i];
if(max<marks[i])
max=marks[i];
sum=sum+marks[i];
}
avg=sum/5;
cout<<“MINIMUM MARKS IS “<<min<<endl;
cout<<“MAXIMUM MARKS IS “<<max<<endl;
cout<<“TOTAL SUM OF MARKS IS “<<sum<<endl;
cout<<“AVERAGE OF MARKS IS “<<avg<<endl;
getch();
}

#include<iostream.h>
#include<conio.h>
void main()
{
  int i,min,max,avg,sum=0,marks[5]={50,70,65,80,56};
  clrscr();
  min=max=marks[0];
  for(i=0;i<5;i++)
  {
   if(min>marks[i])
    min=marks[i];
   if(max<marks[i])
    max=marks[i];
   sum=sum+marks[i];
  }
  avg=sum/5;
  cout<<"MINIMUM MARKS IS "<<min<<endl;
  cout<<"MAXIMUM MARKS IS "<<max<<endl;
  cout<<"TOTAL SUM OF MARKS IS "<<sum<<endl;
  cout<<"AVERAGE OF MARKS IS "<<avg<<endl;
  getch();
}

SCREEN SHOTS:-

CPP_program_Student_Average_marks

OUTPUT:-

CPP_program_Student_Average_marks_Out