Skip to content

Commit

Permalink
test: 2348. 별찍기 #8
Browse files Browse the repository at this point in the history
  • Loading branch information
lledellebell committed Jan 10, 2023
1 parent 2277fba commit e123a8f
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 10 deletions.
6 changes: 3 additions & 3 deletions class01/2348/bee.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function printRightTriangle(size) {
for (var i = 1; i <= size; i++) {
console.log('*'.repeat(i));
}
for (var i = 1; i <= size; i++) {
console.log("*".repeat(i));
}
}
printRightTriangle(5);
2 changes: 1 addition & 1 deletion class01/2348/bee.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 반복문을 이용해
# 직각 삼각형 만들기
def print_right_triangle(size):
def print_right_triangle(size): # (문법) 파이썬은 snake_case로 작성
for i in range(1, size+1):
print('*' * i)

Expand Down
73 changes: 67 additions & 6 deletions class01/2348/bee.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,67 @@
function RightTriangle(size: number): void {
for (let i = 1; i <= size; i++) {
console.log('*'.repeat(i));
}
}
RightTriangle(5);
// function printRightTriangle(size: number): void {
// for (let i = 1; i <= size; i++) {
// console.log('*'.repeat(i));
// }
// }
// printRightTriangle(5);

// 런타임에러1
// const readline = require("readline");

// function printRightTriangle(size: number): void {// 삼각형의 크기를 결정하는 크기 매개 변수를 사용
// // for 문 사용하여 행 반복
// for (let i = 1; i <= size; i++) {
// console.log("*".repeat(i));
// }
// }

// const rl = readline.createInterface({
// input: process.stdin,
// output: process.stdout,
// });

// rl.question("Enter the size of the right triangle: ", (answer) => {
// const size = parseInt(answer);
// printRightTriangle(size);
// rl.close();
// });

// 런타임에러2
// import * as readline from 'readline';

// function printRightTriangle(size: number): void {
// // Use the size parameter to determine the size of the triangle
// // Use a for loop to repeat rows
// for (let i = 1; i <= size; i++) {
// console.log('*'.repeat(i));
// }
// }

// const rl = readline.createInterface({
// input: process.stdin,
// output: process.stdout
// });

// rl.question('Enter the size of the right triangle: ', (answer) => {
// const size = parseInt(answer);
// printRightTriangle(size);
// rl.close();
// });

// 런타임 에러3
// import * as fs from 'fs';

// function printRightTriangle(size: number): void {
// for (let i = 1; i <= size; i++) {
// console.log('*'.repeat(i));
// }
// }

// fs.readFile('triangle_size.txt', 'utf8', (err, data) => {
// if (err) {
// console.error(err);
// } else {
// const size = parseInt(data);
// printRightTriangle(size);
// }
// });

0 comments on commit e123a8f

Please sign in to comment.