I am struggling to figure out how to compute a factorial without the use of the command. My task is to input a nonnegative integer and have the program compute its factorial.
Here is what I have for my script so far.
function Factorial = ex1(n)
if n = 0
Factorial = 1;
elseif n >= 1
Factorial = n(n-1)(n-2)(n-3)(3)(2)(1);
This program does not run, however I do not know where to go from here.