[프로그래머스] 직각삼각형 출력하기 (javascript)

몽슈뜨·2023년 1월 8일
0

programmers

목록 보기
49/62
post-thumbnail

🎯나의 풀이

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 () {
    const num = Number(input[0]);
    let star = ''
    for(let i = 0 ; i < num; i++) {
        for(let j = 0 ; j <= i; j++) {
            star+='*'
        }
        star+='\n'
    }
    console.log(star)
});
profile
개발자되면 맥북사줄께

0개의 댓글