MATLAB: Convert for loop to while

for loopMATLAB Online Serverwhile loop

how can i convert this
n=5;fact = 1 ;
for i = 1:n
fact =fact * i;
end;
disp(fact)
into while loop
with my best regards

Best Answer

i = 1 ;
f = 1 ;
n = 3 ;
while i<=n
f=f*i;
i = i+1 ;
end