Sayed_Tasif_97

Febona

Jan 20th, 2021
623
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //First Function
  2. //{{{{{{{{{{{{{{{{-----__________------}}}}}}}}}}}}}}}}
  3. function feb(n){
  4.     var f = [0, 1];
  5.     let i = 2;
  6.     if (n == 0){
  7.         console.log([0]);
  8.     }
  9.     else if (n == 1){
  10.         console.log([0, 1]);
  11.     }
  12.     else{
  13.         while(i <= n){
  14.             f[i] = f[i-1] + f[i - 2];
  15.             i++
  16.         }
  17.         console.log(f);
  18.     }
  19. }
  20.  
  21. //Second Function
  22. //>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  23. function febo(num){
  24.     var j = [0, 1];
  25.     for(var i = 2; i <= num; i++){
  26.         j[i] = j[i-1] + j[i-2];
  27.     }
  28.     console.log(j);
  29. }
  30. //Result
  31. //--------=========-----------===========-------------
  32.  
  33. feb(5);
  34. febo(10);
RAW Paste Data