[go: up one dir, main page]

0% found this document useful (0 votes)
36 views2 pages

Average

This C++ program calculates the final grade of a student based on grades input for eight subjects. It computes the average and categorizes the result into fail, pass, bronze, silver, or gold based on the average score. The program prompts the user to enter grades for each subject and displays the corresponding grade category.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Average

This C++ program calculates the final grade of a student based on grades input for eight subjects. It computes the average and categorizes the result into fail, pass, bronze, silver, or gold based on the average score. The program prompts the user to enter grades for each subject and displays the corresponding grade category.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/*

*/
#include <iostream>
using namespace std;

int Sub1 = 0;
int Sub2 = 0;
int Sub3 = 0;
int Sub4 = 0;
int Sub5 = 0;
int Sub6 = 0;
int Sub7 = 0;
int Sub8 = 0;
int sumofgrades = 0;
int average = 0;

int main() {

cout<<"This program shows the final grade of student." << endl;


cout<<"Input a grade for each subject" << endl;
cout<<"Subject 1" << endl;
cin>>Sub1;
cout<<"Subject 2" << endl;
cin>>Sub2;
cout<<"Subject 3" << endl;
cin>>Sub3;
cout<<"Subject 4" << endl;
cin>>Sub4;
cout<<"Subject 5" << endl;
cin>>Sub5;
cout<<"Subject 6" << endl;
cin>>Sub6;
cout<<"Subject 7" << endl;
cin>>Sub7;
cout<<"Subject 8" << endl;
cin>>Sub8;

sumofgrades = Sub1+Sub2+Sub3+Sub4+Sub5+Sub6+Sub7+Sub8;
average = sumofgrades/8;

if (average > 59 && average < 75)


{
cout<<"Your grade is " << average << " fail" << endl;
}

else if (average > 74 && average < 90)


{
cout<<"Your grade is " << average << " pass" << endl;
}
else if (average > 89 && average < 95)
{
cout<<"Your grade is " << average << " bronze" << endl;
}
else if (average > 94 && average < 98)
{
cout<<"Your grade is " << average << " silver" << endl;
}
else if (average > 97 && average < 101)
{
cout<<"Your grade is " << average << " gold" << endl;
}

return 0;
}

You might also like