-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (33 loc) · 709 Bytes
/
index.js
File metadata and controls
35 lines (33 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env node
function generate(fnum,howMany){
if (fnum === undefined || howMany === undefined){
console.log("You forgot the parameters")
}
let i=0;
let input = howMany;
let string = "";
let a=1;
let b=1;
let c=0;
while(i < input){
c=a+b;
if(i<input && c>=fnum){
string = string + c+' ';
}
b=c+a;
i++;
if(i<input && b>=fnum){
string = string + b+' ';
}
i++;
a=b+c;
if(i<input && a>=fnum){
string = string + a+' ';
}
i++;
}
return string
}
module.exports ={
generate : generate,
}