Factorial in MATLAB
Example for versions
GNU Octave 3.2.3
This example uses iterative factorial definition. Semicolons at the end of lines suppress the automated output of the calculated values (in this case of fact
) in interactive mode, so that the formatted output doesn’t get littered.
fact = 1;
for i = 0 : 16
printf("%d! = %d\n", i, fact);
fact *= i+1;
endfor
Comments
]]>blog comments powered by Disqus
]]>