Learn Ruby
Assessments
10.1
Assessment

Calculate grade using if and else

John has taken Math test which has 100 questions. John got a score of 28. He got only 28 questions right out of 100 questions.

Write a program that will print grade of John based on the following conditions.

  • If the score is 100 then print You got A+ grade.
  • If the score is more than 80 and less than 100 then print You got A grade.
  • If the score is more than 60 and less than 81 then print You got B grade.
  • If the score is 60 or less than 60 then print You got C grade.

Use if and else conditions to solve this problem.