관리 메뉴

Storage Gonie

(23) [C++] 백준 No.2442 별찍기 - 5 본문

알고리즘/백준풀이1. 입출력

(23) [C++] 백준 No.2442 별찍기 - 5

Storage Gonie 2019. 4. 21. 00:41
반응형

문제

풀이

# C++

#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    
    int N = 0;
    
    cin >> N;
    
   for (int i = 0; i < N ; i++)
   {
        for (int j = 0; j < N-i-1 ; j++)
            cout << " ";

        for (int j = 0; j < 2*(i+1)-1; j++)
            cout << "*";

        cout << endl;
   }
}
반응형
Comments