I don't like any of the Answers so far, not at all. Data should be separated from the code; code should not contain any immediate constants (hard-coded). It should be something like that:
enum Grade { F = -1, D = 60, C = 70, B = 80, A = 90, }
static Grade GetGrade(double age) {
for (Grade grade = Grade.A; grade > Grade.F; grade--)
if (age > (int)grade)
return grade;
return Grade.F;
}
—SA