find factorial Algorithm

In statistics, a full factorial experiment is an experiment whose design consists of two or more factors, each with discrete possible values or" levels", and whose experimental units take on all possible combinations of these levels across all such factors. For example, with two factors each take two levels, a factorial experiment would have four treatment combinations in amount, and is normally named a 2×2 factorial design. 

Factorial designs were used in the 19th century by John Bennet Lawes and Joseph Henry Gilbert of the Rothamsted experimental station. Fisher write," No aphorism is more frequently repeated in connection with field trials, than that we must ask Nature few questions, or, ideally, one question, at a time. A factorial design lets the consequence of several factors and even interactions between them to be determined with the same number of trials as are necessary to determine any one of the consequences by itself with the same degree of accuracy.
%% Factorial
function [f] = find_factorial(n)
% calculate the factorial of a positive integer n
% factorial(n)can be used directly as a default function of Matlab

integerTest= ~mod(n,1); %it returns 0 if value is not an integer.
if integerTest== 0 || n < 0;   % checking n to be positive & integer 
    disp('Error! your number muss be positive and integer');
else
    f = 1;
    for i = 1:n
        f = f*i;
    end
    disp(['factorial of ',num2str(n),' is: ',num2str(f)]);
end
end

LANGUAGE:

DARK MODE: