function x = myfactorial(n) % return the factorial of n x = 1; for i = 1:n x = x * i; end end