function result = fact_recursive(n)
% -----------------------------------------------------
% fact_recursive.m
% -----------------------------------------------------
% A function that uses recursion to evaluate the 
% factorial of given number n. 
% -----------------------------------------------------
% Syntax: result = fact_recursive(n)
% Input: n (a scalar positive integer)
% Output: result = factorial of n (a scalar)
% -----------------------------------------------------
% Notes: This problem can be done without using 
% recursion. 
% -----------------------------------------------------
% Copyright and license details available at matlabmarina.com
%------------------------------------------------------

if n == 0         % Terminating condition
    result = 1;
else
    % Function calls a clone of itself
    % Function is heading toward the terminating condition
    result = n*fact_recursive(n-1);
end
