-
-
Save brntbeer/d462fe580921d6b4a94e to your computer and use it in GitHub Desktop.
From reddit: http://www.reddit.com/r/matlab/comments/1ytrq5/i_have_this_code_for_checking_student_grades/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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