gpa - letter = 'A'; elseif (mygpa >= 2.5)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% 3/2/11  % Exam 1 Practice  % Given a GPA between 0 and 4.0, write a script that uses a switch statement,   % to compute the equivalent letter grade:   % A (4.0  3.5), B (3.4  2.5), C (2.4  1.5), D (1.4 - .5), F (.4  0).  mygpa = input('What is the gpa?\n'); 
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: letter = 'A'; elseif (mygpa >= 2.5) && (mygpa <= 3.4) letter = 'B'; elseif (mygpa >= 1.5) && (mygpa <= 2.4) letter = 'C'; elseif (mygpa >= .5) && (mygpa <= 1.4) letter = 'D'; else letter = 'F'; end disp (letter)...
View Full Document

Ask a homework question - tutors are online