Rewrite the following switch statement as one nested if-else statement (elseif clauses may be used). Assume that there is a variable letter and that it has been initialized
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:4| Question number:23.4
All Answers
total answers (1)
Ch4Ex23.m
letter = char(randi([97,122]));
if letter == 'x'
disp('Hello')
elseif letter == 'y' || letter == 'Y'
disp('Yes')
elseif letter == 'Q'
disp('Quit')
else
disp('Error')
end
need an explanation for this answer? contact us directly to get an explanation for this answer