function grade = letter_grade(score)
if score>=91
grade = 'A';
elseif score>=81 && score<=90
grade = 'B';
elseif score>=71 && score<=80
grade = 'C';
elseif score>=61 && score<=70
grade = 'D';
elseif score<61
grade = 'F';
end
Search Program on this blog
Friday, 6 November 2015
Write a function called letter_grade that takes a positive integer called score as its input argument and returns a letter grade according to the following scale: A: 91 and above; B: 81-90; C: 71-80; D: 61-70; F: below 61. Remember that to assign a letter to a variable, you need to put it in single quotes, as in: grade = 'A'.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment