Advertisement
nhatloi

Viêt một function bằng Javascript in ra dày số fibonaci ở câ

Feb 19th, 2020
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function fibonaci(num)
  2. {
  3.   let temp1=0, temp2=1,i;
  4.     if(num>=1) console.log('1');
  5.     for (i =2;i<=num;i++)
  6.       {
  7.        let temp=temp2;
  8.        temp2+=temp1;
  9.        temp1=temp;
  10.        console.log(temp2);
  11.       }
  12.  
  13. }
  14. // fibonaci(100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement