Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

nth fibonacci number

function nthFibonacci(n, cn = 0, val = 0, pval = 0) {
    if (n == cn) return pval;
    if (val == 0) val++;
    return nthFibonacci(n, cn + 1, val + pval, val);
}
 
PREVIOUS NEXT
Tagged: #nth #fibonacci #number
ADD COMMENT
Topic
Name
2+3 =