ง่าย 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 กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน

เรียนรู้จากคนอื่น

แนวทางจากชุมชน

ยังไม่มีวิธีทำที่เผยแพร่ ลองแก้โจทย์นี้เพื่อแชร์วิธีแรก