옵션 |
|
[출처] 마름모 (#include <stdio.h>
int main(void)
{
int input;
int i, j, e, d;
printf("정수 입력: ");
scanf_s("%d", &input);
e = 0;
for (i = input; i > 0; i--)
{
for (j = 0; j < i; j++)
printf(" ");
printf("*");
for (d=0; d < e; d++)
printf(" ");
printf("*");
e += 2;
printf("\n");
}
for (i = 1; i <= input; i++)
{
for (j = 0; j < i; j++)
printf(" ");
printf("*");
e -= 2;
for (d = e; d > 0; d--)
printf(" ");
printf("*");
printf("\n");
}
return 0;