 # PROBLEM LINK: Contest Page | CodeChef

Practice

Author: Setter’s name

Tester: Tester’s name

Editorialist: Editorialist’s name

DIFFICULTY : BEGINNER

# PROBLEM:

XYZ school has the following grading policy:

If mark is less than or equal to 50, the student gets ‘F’, If mark is greater than 50, but less than or equal to 55, student gets a ‘D’, If mark is greater than 55, but less than or equal to 60, student gets a ‘C’, If mark is greater than 60, but less than or equal to 75, student gets a ‘B’, if mark is greater than 75, but less than or equal to 90, then student gets ‘A’, if mark is above 90, the student get the highest grade - ‘A+’. Your task is to find the grade of a student as per the mark.

# QUICK EXPLANATION:

Output a single line containing the grade corresponding to the mark M.

# EXPLANATION:

Use if else if ladder and follow the problem statement. Input value into an integer variable, say mark. Use <= operator to compare marks and print the corresponding grade.

# SOLUTIONS:

Setter's Solution

using namespace std;

int main() {

int mark;

cin >> mark;

if(mark<=50)

cout<<“F”;

else if(mark<=55)

cout<<“D”;

else if (mark<=60)

cout<<“c”;

else if (mark<=75)

cout<<“B”;

else if (mark<=90)

cout<<“A”;

else

cout<<“A+”;

return 0;

}

Tester's Solution

a=int(input())

if(a>90):

print(“A+”)

elif(a>75 and a<=90):

print(“A”)

elif(a>60 and a<=75):

print(“B”)

elif(a>55 and a<=60):

print(“C”)

elif(a>50 and a<=55):

print(“D”)

else:

print(“F”)

Editorialist's Solution

a=int(input())

if(a>90):

print(“A+”)

elif(a>75 and a<=90):

print(“A”)

elif(a>60 and a<=75):

print(“B”)

elif(a>55 and a<=60):

print(“C”)

elif(a>50 and a<=55):

print(“D”)

else:

print(“F”)