%fact2(number) -> number
%Author: James Atlas CISC106 8:00AM
%Description:
%  Calculating the factorial, which is the 
%   product of numbers from one to n
%Examples:
%  fact2(-5) -> display error
%  fact2(1) -> 1
%  fact2(3) -> 6
function out=fact2(n)
  if (n < 0)
    disp('error, negative number factorial');
  else
    out = 1;
    for i=[1:n]
     out = i * out;
    end
  end