簡単 0件解決済み 正答率0%

Letter Grade

Turn a test score into a letter grade.

問題

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.

制約

0 ≤ score ≤ 100

例

例 1
入力:
score = 85

期待される出力:
expected = "B"
入力:
long long score = 85;

期待される出力:
std::string expected = "B";
入力:
long score = 85;

期待される出力:
string expected = "B";

解説

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

例 2
入力:
score = 59

期待される出力:
expected = "F"
入力:
long long score = 59;

期待される出力:
std::string expected = "F";
入力:
long score = 59;

期待される出力:
string expected = "F";

解説

59 is below 60, so the grade is F.

参考資料

この課題はCodeUtility用に調整されています。上記の説明と制約に従ってください。

他の人の解答から学ぶ

コミュニティの解答

まだ公開された解答がありません。この課題を解いて最初の解答を共有しましょう。