Factorial in MATLAB
Example for versions
GNU Octave 3.2.3
This example uses built-in function factorial
. Note that at this scale of magnitude the results are exact, but in general case Octave is not meant for arbitrary-precision computations, so huge values of factorial will be calculated approximately.
for i = 0 : 16
printf("%d! = %d\n", i, factorial(i));
endfor
Comments
]]>blog comments powered by Disqus
]]>