Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Fibonacci sequence

function myFib(n) {
    if (isNaN(n) || Math.floor(n) !== n)
        return "Not an integer value!";
    if (n === 0 || n === 1)
        return 3;
    else
        return myFib(n - 1) + myFib(n - 2);
}

console.log(myFib(5));


Source by www.homeworklib.com #
 
PREVIOUS NEXT
Tagged: #Fibonacci #sequence
ADD COMMENT
Topic
Name
5+5 =