function N = fac(K)
%
% Function fac calculates the factorial N of K.
%
% Version 1.0, 060410
%
if K < 0
  return
end
if K == 0
  N = 1;
else
  N = 1;
  for I = 2:K
    N = N * I;
  end
end
return