Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

factorial recursion

function factorial(n) {
  // Base case
  if (n === 0 || n === 1) return 1;
  // Recursive case
  return n * factorial(n — 1);
}
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #factorial #recursion
ADD COMMENT
Topic
Name
6+8 =