Make a mark sheet of a student who is enrolled in five subjects. Marks of each subject should be defined by the user. The Output should contain the percentage obtained in each subject, Total marks obtained, Total Marks and percentage attained by the student.
#include<iostream>
using namespace std;
int main(){
int mark[5];
float sum;
cout<<"\nEnter marks obtained in Physics, Chemistry, Maths, CS, English out of 100 :: \n";
for(int i=0; i<5; i++)
{
cin>>mark[i];
sum=sum+mark[i];
}
float perc=(sum/500)*100; // this is for the total percentage optained
cout<<"percentage in each subject "<<endl;
cout<<"physics percentage ="<<mark[0]<<"%"<<endl; //these are the percentage obtained in each subject
cout<<"chemistry percentage ="<<mark[1]<<"%"<<endl;
cout<<"maths percentage ="<<mark[2]<<"%"<<endl;
cout<<"CS percentage ="<<mark[3]<<"%"<<endl;
cout<<"English percentage ="<<mark[4]<<"%"<<endl;
cout<<"Total marks obtained=";
cout<<sum<<endl; // this is thetotal no of marks obtained by the student
cout<<"percentage obtained =";
cout<<perc<<"%"<<endl;
}
Comments
Leave a comment