Challenge: Calculate the Grade Obtained by a Student

Write code to find the grade obtained by a student.

Write code to calculate the grade obtained by a student. The percentage score obtained by a student is given as input. The student gets a grade per the following rules:

  • Grade A: The score is a percentage above or equal to 90.

  • Grade B: The score is a percentage from 80 and 89.

  • Grade C: The score is a percentage from 70 and 79.

  • Grade D: The score is a percentage from 60 and 69.

  • Grade F (Fail): The score is a percentage less than 60.

The input and the output will be:

  • Input: A student’s obtained percentage score will be treated as input.
  • Output: The output will be printed on the console according to the given input.

Get hands-on with 1200+ tech skills courses.