Einfach 0 gelöst 0% Erfolgsquote

Letter Grade

Turn a test score into a letter grade.

Problem

Convert a score from 0 to 100 into a letter grade: 90 and above is A, 80–89 is B, 70–79 is C, 60–69 is D, and below 60 is F.

Implement letter_grade(score).

Input

score: The test score.

Output

Return the letter as a one-character string.

Einschränkungen

0 ≤ score ≤ 100

Beispiele

Beispiel 1
Eingabe:
score = 85

Erwartete Ausgabe:
expected = "B"
Eingabe:
long long score = 85;

Erwartete Ausgabe:
std::string expected = "B";
Eingabe:
long score = 85;

Erwartete Ausgabe:
string expected = "B";

Erläuterung

85 is at least 80 but below 90, so the grade is B.

Beispiel 2
Eingabe:
score = 59

Erwartete Ausgabe:
expected = "F"
Eingabe:
long long score = 59;

Erwartete Ausgabe:
std::string expected = "F";
Eingabe:
long score = 59;

Erwartete Ausgabe:
string expected = "F";

Erläuterung

59 is below 60, so the grade is F.

Referenzen

Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.

Von anderen lernen

Community-Lösungen

Noch keine veröffentlichten Lösungen. Löse die Aufgabe und teile als Erster eine Lösung.