Answer to Question #159032 in C for Arslan habib

Question #159032

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.



1
Expert's answer
2021-01-29T03:42:41-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS