MATLAB: Using a “while” loop to calculate a factorial

displayfactorialMATLABwhile loop

Use a while loop to calculate f=10!. Display only the final value using the function "disp"

Best Answer

kk = 10;
k = 1;
f = 1;
while k <= kk
f = k * f;
k = k + 1;
end
format long
disp(f)
Related Question