[프로그래머스 Lv.0] 직각삼각형 출력하기

blockzzie·2023년 4월 14일
0

프로그래머스

목록 보기
17/52

문제 설명

""의 높이와 너비를 1이라고 했을 때, ""을 이용해 직각 이등변 삼각형을 그리려고합니다. 정수 n 이 주어지면 높이와 너비가 n 인 직각 이등변 삼각형을 출력하도록 코드를 작성해보세요.

제한사항

1 ≤ n ≤ 10

나의 답

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 += 1) console.log('*'.repeat(i));
});
profile
막무가내 코딩노트

0개의 댓글