Skip to content

Instantly share code, notes, and snippets.

@anonymoustafa
Created December 17, 2021 10:52
Show Gist options
  • Save anonymoustafa/73117e3d8b8bae52d639ca70002a4b1b to your computer and use it in GitHub Desktop.
Save anonymoustafa/73117e3d8b8bae52d639ca70002a4b1b to your computer and use it in GitHub Desktop.
A more complete Fibonacci series calculator. Written in NodeJS
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
// ask user for the name input
rl.question(`What Fibbonacci sentence do you want to calculate? `, (last_fibbo_sentence) => {
fibbo(last_fibbo_sentence)
rl.close();
});
function fibbo(L) {
for (let i = 0, j = 1, temp, Latest_Statement = 1; Latest_Statement <= L; temp = i, i = j, j = i + temp,Latest_Statement++) {
console.log(j);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment