PS_Baekjoon

[백준 C++] 7595번 : Triangles

SMILELY 2023. 4. 29. 23:21

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

 

7595번: Triangles

Each line of input contains a single positive integer, n, 1 <= n <= 100. The last line of input contains 0. For each non-zero number, draw a triangle of that size. 

www.acmicpc.net

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int n;
    while(cin >> n && n != 0){
        for(int i=0; i<n; i++){
            for(int j=0; j<=i; j++){
                cout << '*';
            }
            cout << '\n';
        }
    }
}