#C13070. Calculate Letter Grade

    ID: 42568 Type: Default 1000ms 256MiB

Calculate Letter Grade

Calculate Letter Grade

This problem requires you to determine the letter grade corresponding to a given score on a 100-point scale. The grading criteria are as follows:

  • If the score is not between 0 and 100 (inclusive), output Invalid score.
  • If the score is at least 90, the grade is A.
  • If the score is between 80 and 89 (inclusive), the grade is B.
  • If the score is between 70 and 79 (inclusive), the grade is C.
  • If the score is between 60 and 69 (inclusive), the grade is D.
  • Otherwise, the grade is F.

The conditions can be expressed using the following inequalities in \(\LaTeX\):

\(0 \leq score \leq 100\)

\(score \geq 90 \Rightarrow \text{Grade = A}\)

\(80 \leq score \leq 89 \Rightarrow \text{Grade = B}\)

\(70 \leq score \leq 79 \Rightarrow \text{Grade = C}\)

\(60 \leq score \leq 69 \Rightarrow \text{Grade = D}\)

\(score < 60 \Rightarrow \text{Grade = F}\)

inputFormat

A single line containing a numeric score. The input is read from standard input (stdin). The score can be an integer or a floating-point number.

outputFormat

A single line containing the corresponding letter grade or the string 'Invalid score' if the input score is out of the valid range [0, 100]. The output should be written to standard output (stdout).## sample

95
A