% License Creative Commons 0 (like the public domain)
% Use, study, modify and share!
% Even if you are not forced with copyleft, do not forget to respect freedom of others.
% For more informations : https://www.gnu.org/philosophy/free-sw.html
% If you modify it and use it with MATLAB (that is proprietary), please check compatibility with GNU Octave (that is free/libre software that has only few differences).
% This program is provided with no warranty.
% Names of contributors must not be used to endorse or promote products derived from this software without specific prior written permission.
% @author Spanti Nicola (RyDroid)


function result = factorial_integer(number)
	if ~ isnumeric(number)
		error('the parameter must be a number')
	end
	if number < 0
		error('number must be positive')
	end
	
	result = 1;
	while number > 1
	   result = result * number; % result *= number % works with Octave
	   number = number - 1; % --number; % works with Octave
	end
end
