% factorial_formula.m
% Show how to compute a sequence of factorials, using a formula.
%
nmax = input ( 'Enter NMAX, highest factorial to compute: ' );

for n = 0 : nmax

  fact = 1;
  for i = 1 : n
    fact = fact * i;
  end

  fprintf ( ' %d', fact );

end

fprintf ( '\n' );

