code is running but nothing pops up in my workspace?
in my command window it says
lab4
Enter a score (-1 to stop):
ctA = 0; %fill this with the quantity of A grades
ctB = 0; %fill this with the quantity of B grades
ctC = 0; %fill this with the quantity of C grades
ctD = 0; %fill this with the quantity of D grades
ctF = 0; %fill this with the quantity of F grades
d = input(‘Enter a score (-1 to stop): ‘);
scores = []; %empty array where values are stored
while d ~= -1
scores = [scores d]
d = input(‘Enter a score (-1 to stop): ‘);
end
for i =1:length(scores) % length of value i
if (scores(i) >= 90) % input if value is less than or equal to 90
ctA = ctA + 1 % how many As
scores = [scores, i]; % store the # of As in to score
elseif (scores(i) >=80) %input if value is less than or equal to 80
ctB = ctB +1 % how many Bs
scores= [scores i]; %store the # of Bs in to score
elseif (scores(i) >=70) %input if value is less than or equal to 70
ctC = ctC + 1 % how many Cs
scores= [scores i]; %store the # of Cs in to score
elseif (scores(i) >=60) %input if value is less than or equal to 60
ctD = ctD + 1
scores= [scores i];
elseif (scores(i) <60)
ctF = ctF + 1
scores= [scores i];
end
end
%displaying grades
disp("# of As: " + ctA);
disp("# of Bs: " + ctB);
disp("# of Cs: " + ctC);
disp("# of Ds: " + ctD);
disp("# of Fs: " + ctF);in my command window it says
lab4
Enter a score (-1 to stop):
ctA = 0; %fill this with the quantity of A grades
ctB = 0; %fill this with the quantity of B grades
ctC = 0; %fill this with the quantity of C grades
ctD = 0; %fill this with the quantity of D grades
ctF = 0; %fill this with the quantity of F grades
d = input(‘Enter a score (-1 to stop): ‘);
scores = []; %empty array where values are stored
while d ~= -1
scores = [scores d]
d = input(‘Enter a score (-1 to stop): ‘);
end
for i =1:length(scores) % length of value i
if (scores(i) >= 90) % input if value is less than or equal to 90
ctA = ctA + 1 % how many As
scores = [scores, i]; % store the # of As in to score
elseif (scores(i) >=80) %input if value is less than or equal to 80
ctB = ctB +1 % how many Bs
scores= [scores i]; %store the # of Bs in to score
elseif (scores(i) >=70) %input if value is less than or equal to 70
ctC = ctC + 1 % how many Cs
scores= [scores i]; %store the # of Cs in to score
elseif (scores(i) >=60) %input if value is less than or equal to 60
ctD = ctD + 1
scores= [scores i];
elseif (scores(i) <60)
ctF = ctF + 1
scores= [scores i];
end
end
%displaying grades
disp("# of As: " + ctA);
disp("# of Bs: " + ctB);
disp("# of Cs: " + ctC);
disp("# of Ds: " + ctD);
disp("# of Fs: " + ctF); in my command window it says
lab4
Enter a score (-1 to stop):
ctA = 0; %fill this with the quantity of A grades
ctB = 0; %fill this with the quantity of B grades
ctC = 0; %fill this with the quantity of C grades
ctD = 0; %fill this with the quantity of D grades
ctF = 0; %fill this with the quantity of F grades
d = input(‘Enter a score (-1 to stop): ‘);
scores = []; %empty array where values are stored
while d ~= -1
scores = [scores d]
d = input(‘Enter a score (-1 to stop): ‘);
end
for i =1:length(scores) % length of value i
if (scores(i) >= 90) % input if value is less than or equal to 90
ctA = ctA + 1 % how many As
scores = [scores, i]; % store the # of As in to score
elseif (scores(i) >=80) %input if value is less than or equal to 80
ctB = ctB +1 % how many Bs
scores= [scores i]; %store the # of Bs in to score
elseif (scores(i) >=70) %input if value is less than or equal to 70
ctC = ctC + 1 % how many Cs
scores= [scores i]; %store the # of Cs in to score
elseif (scores(i) >=60) %input if value is less than or equal to 60
ctD = ctD + 1
scores= [scores i];
elseif (scores(i) <60)
ctF = ctF + 1
scores= [scores i];
end
end
%displaying grades
disp("# of As: " + ctA);
disp("# of Bs: " + ctB);
disp("# of Cs: " + ctC);
disp("# of Ds: " + ctD);
disp("# of Fs: " + ctF); workspace MATLAB Answers — New Questions









