Write a script that will prompt the user for a quiz grade and error-
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:5| Question number:33.5
All Answers
total answers (1)
Ch5Ex33.m
% Prompt the user for a quiz grade and error-check
% until a valid grade is entered; using any or all
quiz = input('Enter a quiz grade: ');
validgrades = 0: 0.5: 10;
while ~any(quiz == validgrades)
quiz = input('Invalid! Enter a quiz grade: ');
end
fprintf('The grade is %.1f\n', quiz)
need an explanation for this answer? contact us directly to get an explanation for this answer