% hw013.m
% John Burkardt
% Print divisors of N.
%
%  N is the number to factor.
%  I is our current divisor.
%
n = input ( 'Enter an integer N > 1: ' );

if ( n <= 1 )
  error ( '  N must be greater than 1!' );
end

fprintf ( '' );
fprintf ( 'Factors of %d:', n );
fprintf ( '' );
i = 2;
while ( 1 < n )
  if ( mod ( n, i ) == 0 )
    n = n / i;
    fprintf ( ' %d', i );
  else
    i = i + 1;
  end
end
fprintf ( '\n' );
