# 직각삼각형 출력하기

## **문제**

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

***

**제한사항**

* 1 ≤ `n` ≤ 10

***

**입출력 예**

입력 #1

```
3
```

출력 #1

```
*
**
***
```

**입출력 예 설명**

입출력 예 #1

* n이 3이므로 첫째 줄에 \* 1개, 둘째 줄에 \* 2개, 셋째 줄에 \* 3개를 출력합니다.

## 코드

```javascript
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))
    }
    process.exit();
});
```

#### ❓ readline 사용법

```javascript
const readline = require("redaline"); // readline 모듈 불러오기
const rl = readline.createInterface({ // 인터페이스 생성
	input: process.stdin,
	output: process.stdout,
});
rl.on("line", (line) => {
	/*입력받는 값을 처리하는 코드*/
	rl.close();
});

rl.on("close", () => {
	/*입력이 끝나고 실행할 코드*/
	process.exit();
});

```

[참고](https://velog.io/@leenzy/readline-%EB%AA%A8%EB%93%88-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://songeun.gitbook.io/coding-test/lv.0/24.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
