Re-develop these functions using the while loop control structure instead of the
ID: 3564514 • Letter: R
Question
Re-develop these functions using the while loop control structure instead of the for loop
control structure. When developing your functions, start with the following frameworks:
Explanation / Answer
function [output] = userDefinedArraySum(input=[1 2 3 4 5])
t=length(input);
output=0;
while t>0
output=output+input(t);
t=t-1;
end
display('sum of [1 2 3 4 5] = ');
display(output);
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.