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