Closed minseo-jung closed 5 years ago
몇단을 쌓으시겠습니까?
10
**********
*********
********
*******
******
*****
****
***
**
*
이중 포문 버전
int a;
int b = 0;
int c = 0;
printf("몇단을 쌓으시겠습니까?\n");
scanf("%d", &a);
c = a ;
for (; a > 0; a--)
{
for (b = 0; b < c; b++)
{
if (b < c - a) {
printf(" ");
} else {
printf("*");
}
}
printf("\n");
}
이중포문으로 해결하고 싶었으나 아무리 생각해도 안떠올라 삼중포문으로...ㅠㅠ