This the orginal question, but as you answer can you provide a reason as to why
ID: 3923889 • Letter: T
Question
This the orginal question, but as you answer can you provide a reason as to why you out that input in your code. Also I know that the code is suppose to start with
grade=input('Please enter your grade');
I'm stuck that when i enter any vaule higher than 66 it always results with a letter grade D
the following MATLAB code is intended to assign a letter grade based on a numerical grade (the numerical grades are percentages). Will this code work properly? If not, explain why and rewrite the code so that it works as intended. (Assume that the variable grade is assigned a value before this code is run.)
end
Explanation / Answer
try this matlab code. you will get right result.
main.m
clc;
close all;
clear all;
grade=input('Please enter your marks : ');
if grade < 66.0
disp('The grade is F.')
elseif grade >= 66.0 && grade <76.0
disp('The grade is D.')
elseif grade >= 76.0 && grade <86.0
disp('The grade is C.')
elseif grade >= 86.0&& grade <95.0
disp('The grade is B.')
elseif grade >= 95.0
disp('The grade is A.')
end
Output:
Please enter your marks : 96
The grade is A.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.