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

for n = 0 : nmax

  if ( n == 0 )
    fact = 1;
  else
    fact = fact * n;
  end

  fprintf ( ' %d', fact );

end

fprintf ( '\n' );

