<입문 100문제> Day 6 - 문자열, 반복문, 출력, 배열, 조건문
문제
풀이
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let input = [];
rl.on('line', function (line) {
input = line.split(' ');
}).on('close', function () {
for (let i=1; i<= +input[0]; i++) {
console.log('*');
}
});
해답
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on('line', function (line) {
input = line.split(' ');
}).on('close', function () {
for (let i = 1; i <= +input[0]; i++) console.log('*'.repeat(i));
});