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';
}
}
}
'PS_Baekjoon' 카테고리의 다른 글
[백준 C++] 6840번 : Who is in the middle? (0) | 2023.05.01 |
---|---|
[백준 C++] 6763번 : Speed fines are not fine! (0) | 2023.04.28 |
[백준 C++] 6749번 : Next in line (1) | 2023.04.27 |
[백준 C++] 5717번 : 상근이의 친구들 (0) | 2023.04.26 |
[백준 C++] 4470번 : 줄번호 (0) | 2023.04.25 |