function [nfac]=fac(n) %this function computes n! if n==0 nfac=1; else x=1:n; nfac=prod(x); end