[백준] 2442번 : 별 찍기-5 - C++

강재원·2022년 9월 22일
0

[코딩테스트] C/C++

목록 보기
65/200



https://www.acmicpc.net/problem/2442

#include <iostream>

using namespace std;

int main() {
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int k=0;k<n-i;k++){
            cout<<" ";
        }
        for(int j=0;j<(i-1)*2+1;j++){
            cout<<"*";
        }
        cout<<"\n";
    }
}
profile
개념정리 & 문법 정리 & 알고리즘 공부

0개의 댓글