GUVI
Back

Absolute Beginner Question 9  Print the table of nine with a single space between the elements till the number is input.

Created 2 years ago
435 Views
2 Comments
RoshanMThomas
@RoshanMThomas
RoshanMThomas
@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 });
Comments (2)
Please login to comment.
 
Powered by habitate.io Habitate