https://www.acmicpc.net/problem/7595
It is not hard to draw a triangle of stars of any given size. For example, a size 5 triangle would look like this (5 stars high and 5 stars wide):
Your task is to draw triangles in a number of sizes.
<script>
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int count;
void triangle(int num) {
for (int i = 0; i < num; i++) {
for (int j = 0; j < i + 1; j++) {
printf("*");
}
printf("\n");
}
// 입력한 수에 맞는 삼각형을 만드는 함수
}
int main()
{
while (1) {
scanf("%d", &count);
if (count == 0) {
break;
}
else {
triangle(count);
}
// count 변수값이 0이 아니라면, triangle(count)를 사용한다.
}
return 0;
}
</script>