Skip to content

Instantly share code, notes, and snippets.

@brntbeer
Created February 24, 2014 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brntbeer/d462fe580921d6b4a94e to your computer and use it in GitHub Desktop.
Save brntbeer/d462fe580921d6b4a94e to your computer and use it in GitHub Desktop.
% Problem 2
prompt = 'Would you like to check your grade? (Enter yes or no)';
str = input(prompt, 's')';
if isempty(str);
str = 'yes';
end;
prompt = 'please enter your score';
result = input(prompt);
s = result;
if s >= 89.5 && s <= 100;
disp('Your overall scrore is an A');
elseif s >= 79.5 && s <= 89.5;
disp('Your overall scrore is a B');
elseif s >= 69.5 && s <= 79.5;
disp('Your overall scrore is a C');
elseif s >= 59.5 && s <= 69.5;
disp('Your overall scrore is a D');
elseif s >= 0 && s <= 59.5;
disp('Your overall scrore is an F');
else s > 100 && s < 0;
disp('Invalid grade entered');
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment