function fact = factorial(x)
% FACTORIAL, returns the factorial  x!
% Input:
%	x - number to take factorial
% Output:
%	x! - 1*2*3*...*x
%
%
fact = 1;		% sets factorial to be one for now.
if floor(x)-x == 0;	% makes sure this is an integer
     if x>0;
          for i = 1:x;
	       fact = fact * i;
	  end
     end
     else;
     disp ('Value given for x is not an integer.')
     fact = [];
     end
end;
