Advertisement
Guest User

Fibonacci Algorithm

a guest
Dec 11th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function fibonacci(n) {
  2.   if(n === 0) {
  3.     return 0;
  4.   } else if (n === 1) {
  5.     return 1;
  6.   } else {
  7.     return fibonacci(n - 1) + fibonacci(n - 2);
  8.   }
  9. }
  10.  
  11. fibonacci(7);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement