Question
Note: the subject is MATLAB Need to use ( SWITCH statement instead of IF statement ) to get the same result as it is %%
Note: the subject is MATLAB
Need to use ( SWITCH statement instead of IF statement ) to get the same result as it is
%%
clc clear close all
for k = 1:5 X = input('Enter a score for between 0 and 100 : '); if (X >= 90) Lettergrade = 'A' elseif (X >= 80) Lettergrade = 'B' elseif(X >=70) Lettergrade = 'C' elseif(X >=60) Lettergrade = 'D' elseif(X<60) Lettergrade = 'F' end end
_________________________
that what i got so far BUT its give an error
for k = 1:5 X = input('Enter a score for between 0 and 100 : '); Switch X case 'X >= 90' disp('Letter Grade = A')
case 'X >= 80' disp('Letter Grade = B')
case 'X >= 70' disp('Letter Grade = C')
case 'X >= 60' disp('Letter Grade = D')
case 'X < 60' disp('Letter Grade = F') end end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started