Absolute Beginner Question 9 Print the table of nine with a single space between the elements till the number is input.
@RoshanMThomasProfile is locked. Login // Getting input via STDIN const readline = require("readline"); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => { //start-here //Your code goes here … replace the below line with your code logic let N = userInput[0]; let res = ""; if ( +N === 0) { console.log("NULL"); } else { for ( let i = 1; i<=N; i++) { let table = 9 * i; res += table + " "; } console.log(res); } //end-here });
Powered by Habitate