Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4-honggukang0623 #17

Merged
merged 1 commit into from
May 10, 2024
Merged

4-honggukang0623 #17

merged 1 commit into from
May 10, 2024

Conversation

Ghdrn1399
Copy link
Contributor

πŸ”— 문제 링크

https://school.programmers.co.kr/learn/courses/30/lessons/120823

βœ”οΈ μ†Œμš”λœ μ‹œκ°„

20λΆ„

✨ μˆ˜λ„ μ½”λ“œ

μ „μ²΄μ½”λ“œ

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 n = Number(input[0]);

    let line = 1;
    while(line <= n){
        
        let starStr = "";
        let cnt = 0;
        while(cnt < line){
            starStr = starStr+"*"
            cnt = cnt + 1;
        }
        
        console.log(starStr)
        line = line + 1;  
    }
});

좜λ ₯ν•  별을 λ§Œλ“€μ–΄ 쀄 μ½”λ“œλ₯Ό μž‘μ„±ν•©λ‹ˆλ‹€.

let line = 1;
    while(line <= n){
        
        let starStr = "";
        let cnt = 0;
        while(cnt < line){
            starStr = starStr+"*"
            cnt = cnt + 1;
        }
        
        console.log(starStr)
        line = line + 1;  
    }
});

λ°˜λ³΅ν•  λ•Œ λ§ˆλ‹€ 별을 μΆ”κ°€ν•΄μ£ΌλŠ” μ½”λ“œλ₯Ό μž‘μ„±
starStr = starStr+"*"

μ½˜μ†” 둜그λ₯Ό ν™œμš©ν•΄μ„œ 좜λ ₯ν•˜λŠ” μ½”λ“œλ₯Ό μž‘μ„±ν•©λ‹ˆλ‹€.
console.log(starStr)

이상 jsλ₯Ό ν™œμš©ν•΄μ„œ κ°„λ‹¨ν•œ μ§κ°μ‚Όκ°ν˜• 좜λ ₯ν•˜λŠ” λ¬Έμ œμ˜€μŠ΅λ‹ˆλ‹€.

πŸ“š μƒˆλ‘­κ²Œ μ•Œκ²Œλœ λ‚΄μš©

@Ghdrn1399 Ghdrn1399 self-assigned this Apr 10, 2024
@suhyun113 suhyun113 changed the title 2024-04-09 μ§κ°μ‚Όκ°ν˜• 좜λ ₯ν•˜κΈ° 4-honggukang0623 Apr 11, 2024
Copy link
Member

@oesnuj oesnuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ˜€λžœλ§Œμ— λ¦¬λ·°λ‚¨κΈ°λ„€μš”~
별찍기 문제 이쀑 λ°˜λ³΅λ¬Έμ„ ν™œμš©ν•œ μ½”λ“œ μž˜λ΄€μŠ΅λ‹ˆλ‹€!!
pr μˆ˜κ³ ν–ˆμ–΄μš”πŸ‘

Comment on lines +14 to +22
let line = 1;
while(line <= n){

let starStr = "";
let cnt = 0;
while(cnt < line){
starStr = starStr+"*"
cnt = cnt + 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이쀑 λ°˜λ³΅λ¬Έμ„ μ‚¬μš©ν•˜μ…¨λŠ”λ° 반볡문 ν•œλ²ˆμœΌλ‘œλ„ 지 수 μžˆμ–΄μ„œ μ½”λ“œ μ²¨λΆ€ν•΄λ΄…λ‹ˆλ‹€!!

let starStr = "";
    for (let i = 1; i <= n; i++) {
        starStr += "*";
        console.log(starStr);
    }

Copy link
Collaborator

@pu2rile pu2rile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c둜 반볡문 처음 배웠을 λ•Œ ν’€μ–΄ 봀던 문제인데 μžλ°”μŠ€ν¬λ¦½νŠΈ μ½”λ“œλ‘œ λ³΄λ‹ˆ μ œλ²• κΈ°λ„€μš”...?

#include <stdio.h>

int main() {
    int n;
 
    printf("높이λ₯Ό μž…λ ₯ν•˜μ„Έμš”: ");
    scanf("%d", &n);
    
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= i; j++) {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}

이건 전에 μ œκ°€ ν’€μ—ˆλ˜ μ½”λ“œμΈλ° 언어별 κ³΅ν†΅μ μ΄λ‚˜ 차이점 λ³΄μ‹œλ©΄ 쒋을 것 κ°™μ•„μ„œ λ‚¨κ²¨λ†“μŠ΅λ‹ˆλ‹€!

Copy link
Collaborator

@suhyun113 suhyun113 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 λ¬Έμ œλŠ” νŒŒμ΄μ¬μ„ λ°°μš°λ©΄μ„œ 처음 μ ‘ν•΄λ΄€λ˜ λ¬Έμ œλ„€μš”!! μ²˜μŒμ— *둜 μ‚¬κ°ν˜•μ„ 좜λ ₯ν•˜λŠ” 문제둜 μ‹œμž‘ν–ˆμ—ˆλŠ”λ°, 그땐 μ‰¬μ› λŠ”λ° μ‚Όκ°ν˜•μœΌλ‘œ ν™œμš©ν•˜λ €λ‹ˆ μ–΄λ €μ› μ—ˆλ˜ 기얡이 μžˆμ–΄μš”..γ…œγ…œ μžλ°”μŠ€ν¬λ¦½νŠΈ μ½”λ“œλ‘œ μ§  것을 보고 μ²˜μŒμ— μ½”λ“œκ°€ 이해가 λ˜μ§€ μ•Šμ•„ μ–΄λ €μ› λŠ”λ°, μž…λ ₯을 λ°›λŠ” 뢀뢄이 μžλ°”μŠ€ν¬λ¦½νŠΈλŠ”

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 () {
    console.log(Number(input[0]));
});

이런 μ‹μœΌλ‘œ μ‚¬μš©λœλ‹€λŠ” 것을 μ•Œκ²Œ λ˜μ—ˆμ–΄μš”! μ œκ°€ 파이썬으둜

n = int(input())
for i in range(1, n+1):
    for j in range(i): 
        print("*", end="")
    print(" ")

μ°Έκ³ ν•˜μ‹œλ©΄ 쒋을 것 κ°™μ•„μš”!
PRμž‘μ„± 잘 ν•˜μ…¨μ–΄μš”!

@Ghdrn1399 Ghdrn1399 merged commit 79f09ec into main May 10, 2024
1 check passed
@Ghdrn1399 Ghdrn1399 deleted the 4-honggukang0623 branch May 10, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants