<div><br></div> <div><br></div> <div><br></div> <div><pre>#include <stdio.h> #include <math.h> void main (void) { int cnt; retry: printf("다이아몬드의 높이를 입력하세요. (홀수, 3이상)\n > "); scanf("%d", &cnt); fflush(stdin); if( cnt % 2 == 0 || cnt < 3 ) { printf("잘못입력했습니다.\n"); goto retry; } for(int row = 0; row < cnt; row++) { for( int col = 0; col < cnt; col++) { if( ( (row + col) % (cnt / 2) == 0 && ((row + col) % (cnt - 1)) != 0 ) || ( (row - col) % (cnt / 2) == 0 && abs((row - col) % (cnt - 1)) == (cnt - 1) / 2 ) ) printf("*"); else printf(" "); } printf("\n"); } printf("한번더?(y/n)\n > "); scanf("%c", &cnt); fflush(stdin); if( cnt == 'y' || cnt == 'Y') goto retry; }</pre><pre><br></pre><pre><br></pre><pre>예전에 더 쉽게 만드는 방법을 알았는데. 이번엔 뭔가 이상한 공식을 써서 만들게 됬네요 ㅋㅋ</pre><pre>만들때마다 다른 구조를 띄는거 같습니다. </pre><pre><br></pre><pre><br></pre><pre>자 여러분 도전해보시겠습니까?</pre></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.