Skip to main content

C++ Program to Find Grade of a Student using if else

Programming Languages

 Welcome to coding world

C++ Program to Find Grade of a Student using if else

Write a C++ Program to Find Grade of a Student using if else. Here’s simple C++ Program to Find Grade of a Student using if else in C++ Programming Language.

Numbers in C++

Normally, when we work with Numbers, we use primitive data types such as int, short, long, float and double, etc. The number data types, their possible values and number ranges have been explained while discussing C++ Data Types.

To calculate grade of a student on the basis of his total marks in C++ Programming, you have to ask to the user to enter marks obtained in some subjects.

To calculate grade of student, first calculate the mark’s sum of all the subjects and then calculate average marks. Now start checking for the grades to display the result as shown here in the following program.

Here is source code of the C++ Program to Find Grade of a Student using if else. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.

 SOURCE CODE : 

/*  C++ Program to Find Grade of a Student using if else  */

 

#include<iostream>

using namespace std;

 

int main()

{

        int mark[5], i;

        float sum=0,avg;

 

        cout<<"\nEnter Marks in 5 subjects :: \n";

        for(i=0; i<5; i++)

        {

            cout<<"\nEnter Marks[ "<<i+1<<" ] :: ";

                cin>>mark[i];

                sum=sum+mark[i];

        }

 

        avg=sum/5;

 

        cout<<"\nYour Grade is :: ";

        if(avg>80)

        {

                cout<<"[ A ]\n";

        }

        else if(avg>60 && avg<=80)

        {

                cout<<"[ B ]\n";

        }

        else if(avg>40 && avg<=60)

        {

                cout<<"[ C ]\n";

        }

        else

        {

                cout<<"[ D ]\n";

        }

 

        return 0;

}


OUTPUT :

/*  C++ Program to Find Grade of a Student using if else  */

 

Enter Marks in 5 subjects ::

 

Enter Marks[ 1 ] :: 78

 

Enter Marks[ 2 ] :: 87

 

Enter Marks[ 3 ] :: 67

 

Enter Marks[ 4 ] :: 99

 

Enter Marks[ 5 ] :: 90

 

Your Grade is :: [ A ]

 

Process returned 0

Above is the source code for C++ Program to Find Grade of a Student using if else which is successfully compiled and run on Windows System. The Output of the program is shown above.

 If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section. We will try our best to reach up to you in short interval.

Popular posts from this blog

Bollywood actor Dharmendra has passed away at the age of 89

Legendary Bollywood actor Dharmendra has passed away at the age of 89.  R. I. P The 'He-Man' of Indian cinema, known for his iconic roles in films like 'Sholay', 'Seeta Aur Geeta', and 'Dharam Veer', breathed his last on November 24, 2025, in Mumbai. Dharmendra's career spanned over six decades, with more than 300 films to his credit. He was a recipient of the Filmfare Lifetime Achievement Award and the Padma Bhushan, among other accolades. His family, friends, and fans are mourning his loss, remembering him as a kind soul and an unforgettable icon of Indian cinema. 

Jobs in Lahore June 2026 | Lahore Jobs 2026 | Latest jobs in Lahore

Job available for Lahore residence. Great opportunity for females. Comment msg for further details. click on link to apply job for freshers in Lahore:  Apply here Job Details 1: Receptionist Full job description Job opportunity join us as Branch Receptionist staff. Office base job and permanent job opportunity. Opportunity to join company official branch Receptionist staff. Responsibilities: 1-Office work 2-Strong command of Microsoft Office 3- Strong communication Skills 4- Typing speed 3.7+ 5- Strong web browsing skills Rewards: 1-Basic Salary 52000 2- Fuel Allowance 3- Medical Facility 4- Insurance Cover Working place is to good for male and females this is professional Branch Receptionist Staff Job Types: Full-time, Fresher Pay: Rs43,500.00 - Rs55,200.00 per month Ability to commute/relocate: Lahore: Reliably commute or planning to relocate before starting work (Preferred) Education: Bachelor's (Preferred) Work Location: In person Click here to apply now Job Details 2: Job Deta...

Good Morning Wishes