My code is as follows:
A=0;B=0;C=0;D=0;F=0;
x=input('Enter an exam grade from 0 to 100: '); %Prompts the user to input a value to begin the loop
while (x>=0) && (x<=100)
if x<60 F=F+1; %Adds to the total amount of grades in the category
elseif x<70 D=D+1; elseif x<80 C=C+1; elseif x<90 B=B+1; elseif x<=100 A=A+1; end %ends conditional statements to move to next input
x=input('Enter an exam grade from 0 to 100: '); %input runs within the loop until a value less than 0 or greater than 100 is entered
end
fprintf('There are a total of %.0f A''s scored on the exam.\n',A)
fprintf('There are a total of %.0f B''s scored on the exam.\n',B)
fprintf('There are a total of %.0f C''s scored on the exam.\n',C)
fprintf('There are a total of %.0f D''s scored on the exam.\n',D)
fprintf('There are a total of %.0f F''s scored on the exam.\n',F)
Best Answer