Write a program that takes the marks from the user and tells the grade corresponding to the marks. The marks and corresponding grades are mentioned below:
Marks Grades
Greater than 90 A
Greater than or equal to 86 and less than 90 A-
Greater than or equal to 81 and less than 86 B+
Greater than or equal to 77 and less than 81 B
Greater than or equal to 72 and less than 77 B-
Greater than or equal to 68 and less than 72 C+
Greater than or equal to 63 and less than 68 C
Greater than or equal to 58 and less than 63 C-
Greater than or equal to 54 and less than 58 D+
Greater than or equal to 50 and less than 54 D
Below 50 F
#include<iostream>
using namespace std;
int main()
{
int marks;
cout<<"Enter the mark: ";
cin>>marks;
if(marks>90){
cout<<"Grade is: A";
}
else if(marks>=86 &&marks<90){
cout<<"Grade is: A-";
}
else if(marks>=81 &&marks<86){
cout<<"Grade is: B+";
}
else if(marks>=77 &&marks<81){
cout<<"Grade is: B";
}
else if(marks>=72 &&marks<77){
cout<<"Grade is: B-";
}
else if(marks>=68 &&marks<72){
cout<<"Grade is: C+";
}
else if(marks>=63 &&marks<68){
cout<<"Grade is: C";
}
else if(marks>=58 &&marks<63){
cout<<"Grade is: C-";
}
else if(marks>=54 &&marks<58){
cout<<"Grade is: D+";
}
else if(marks>=50 &&marks<54){
cout<<"Grade is: D";
}
else{
cout<<"Invalid marks";
}
}
Comments
Leave a comment