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

Here’s a simple C++ program that calculates the grade of a student based on their marks

The program prompts the user to enter the marks obtained by a student. The program then uses if-else statements to calculate the grade based on the entered marks. The grading criteria are as follows:

  • Marks greater than 90 or equal to 100 results in an ‘A+‘ grade.
  • Marks greater than or equal to 80 but less than 90 results in an ‘A‘ grade.
  • Marks greater than or equal to 70 but less than 80 results in a ‘B‘ grade.
  • Marks greater than or equal to 60 but less than 70 results in a ‘C‘ grade.
  • Marks greater than or equal to 50 but less than 60 results in a ‘D‘ grade.
  • Marks below 50 result in an ‘F‘ grade.

The program then displays the student’s calculated grade.

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

#include<iostream>
using namespace std;

int main()
{
int a;

cout<<“Enter Student’s Marks:: \n”;
cin>>a;

if(a>90 && a<=100)
{
cout<<“Grade A+\n”;
}
else if(a>80 && a<=90)
{
cout<<“Grade A\n”;
}
else if(a>70 && a<=80)
{
cout<<“Grade B\n”;
}
else if(a>60 && a<=70)
{
cout<<“Grade C\n”;
}
else if(a>50 && a<=60)
{
cout<<“Grade D\n”;
}
else
{
cout<<“Grade F\n”;
}

return 0;
}

Download

1 thought on “C++ Program to Find Grade of a Student Using if else”

  1. Good Information Thank you so much for this informative website
    I was just finding the accurate data about this topic and here I just got the exact data which is represented in a very beautiful way ….
    Thank you again

    Reply

Leave a Comment