C++ Program to Find Student Grade

Write a C++ program to find student grades using their marks. The below C++ program allows users to enter marks of five different subjects. Next, we are calculating the total, average, and percentage of those five subjects. Based on the percentage, we are printing the student grade.

#include<iostream>

using namespace std;

int main()
{
	int english, chemistry, computers, physics, maths; 
    float total, average, percentage;

    cout << "Please Enter the marks of five subjects: \n";
    cin >> english >> chemistry >> computers >> physics >> maths;

    total = english + chemistry + computers + physics + maths;
    average = total / 5;
    percentage = (total / (500)) * 100;

    cout << "\nTotal Marks      = " << total;
    cout << "\nAverage Marks    = " << average;
    cout << "\nMarks Percentage = " << percentage;
    
    if(percentage >= 90)    {
    	cout << "\nGrade A";
	}
	else if(percentage >= 80)    {
    	cout << "\nGrade B";
	}
	else if(percentage >= 70)    {
    	cout << "\nGrade C";
	}
	else if(percentage >= 60)    {
    	cout << "\nGrade D";
	}
	else if(percentage >= 40)    {
    	cout << "\nGrade E";
	}
	else {
    	cout << "\nFail";
	} 
	
 	return 0;
}
C++ Program to Find Student Grade 1