Problème
Afficher la traductionConvert 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.
Contraintes
0 ≤ score ≤ 100
Exemples
Exemple 1
Entrée :
score = 85
Sortie attendue :
expected = "B"
Entrée :
long long score = 85;
Sortie attendue :
std::string expected = "B";
Entrée :
long score = 85;
Sortie attendue :
string expected = "B";
Explication
85 is at least 80 but below 90, so the grade is B.
Exemple 2
Entrée :
score = 59
Sortie attendue :
expected = "F"
Entrée :
long long score = 59;
Sortie attendue :
std::string expected = "F";
Entrée :
long score = 59;
Sortie attendue :
string expected = "F";
Explication
59 is below 60, so the grade is F.
Références
Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.