WAP C++ to store marks of subject each out of 100. obtained by a student caalculate his or her total marks percentage and grade accoriding to following criteria .
per >=80 grade -A
65<=per<80 grade-B
55<=per<65 grade-c
50<=per<55 grade-d
per<50 FAIL
#include <iostream>
using namespace std;
int main()
{
float m1,m2,m3,m4,m5,per,total;
cout<<"enter the marks of 5 subjects:-";
cin>>m1>>m2>>m3>>m4>>m5;
total=m1+m2+m3+m4+m5;
per=(total*100)/500;
cout<<"total="<<total;
if(per>=80){
cout<<"\ngrade - A";
cout<<"\npercentage:-"<<per;
}
else
if(per>=65&&per<80){
cout<<"\ngrade - B";
cout<<"\npercentage:-"<<per;
}
else
if(per>=55&&per<65)
{
cout<<"\ngrade - C";
cout<<"\npercentage:-"<<per;
}
else
if(per>=50&&per<55)
{
cout<<"\ngrade - D";
cout<<"\npercentage:-"<<per;
}
else{
cout<<"\nFAIL";
cout<<"\npercentage:-"<<per;
}
return 0;
}
Output:-
enter the marks of 5 subjects:-80
70
65
82
72
total=369
grade - B
percentage:-73.8