The factorial of a number, say N is the product of first N natural numbers. Thus, factorial of 5 can be obtained by taking the product of 5 and factorial of 4. Similarly factorial of 4 be found out by taking the product of 4 and factorial of 3. At last the factorial of 1 is 1 itself.
Which technique is applicable to find the factorial of a number in this fashion? Write a C++ function to implement this technique. Also explain the working of the function by giving the number 5 as input.