NODE
node
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
// Challenge by Ioannis Alexandros Makropoulos
// https://www.sololearn.com/Discuss/1054708
// Challenge: Create Pascal's triangle (mathematical object)
// Output to the screen a working figure of the triangle. Any suitable language
// 1) Pascal's pattern is generated from the top of the pyramid ie first row
// 2) Starting with number 1, then 11 seperated by a space as in (1 " ") ,followed that by square of 11 then the cube, etc.
// triangle is a perfectly symmetrical mirror image having a line down through the middle innermost digits
// 3) Bonus if can link the algebraic format for handling each row with expression as 'x' or 'a'
// Interface to I/O system.
const rl = require("readline").createInterface({
input: process.stdin,
output: process.stdout });
// Event handler to call our program on
// input of a line.
rl.on('line', input => { main(input); });
// Function to shorten the usage of floor
// elsewhere.
function floor(num) {
return Math.floor(num);
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run