Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //First Function
- //{{{{{{{{{{{{{{{{-----__________------}}}}}}}}}}}}}}}}
- function feb(n){
- var f = [0, 1];
- let i = 2;
- if (n == 0){
- console.log([0]);
- }
- else if (n == 1){
- console.log([0, 1]);
- }
- else{
- while(i <= n){
- f[i] = f[i-1] + f[i - 2];
- i++
- }
- console.log(f);
- }
- }
- //Second Function
- //>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- function febo(num){
- var j = [0, 1];
- for(var i = 2; i <= num; i++){
- j[i] = j[i-1] + j[i-2];
- }
- console.log(j);
- }
- //Result
- //--------=========-----------===========-------------
- feb(5);
- febo(10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement