image thumbnail
from Essential MATLAB by Brian Hahn
Companion software for Essential MATLAB for Scientists and Engineers

factorial.m
n = 10;
fact = 1;           
                   
for k = 1:n         
   fact = k * fact;
   disp( [k fact] )
end   

Contact us at files@mathworks.com