<P>#include<stdio.h><BR>#define N 10</P> <P><BR>int main(void)<BR>{ int A[N]={5,2,7,4,1};<BR> int i,n;<BR><SPAN style="COLOR: #ff5e00"> int j=4;</SPAN><BR> int m=4;</P> <P> </P> <P> <SPAN style="COLOR: #ff5e00">for(n=0;n<=m;n++)</SPAN><BR><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00">{</SPAN><BR><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"></SPAN><SPAN style="COLOR: #ff5e00">for(i=m;i>=0;i--)</SPAN><BR><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00">{</SPAN><BR><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"></SPAN><SPAN style="COLOR: #ff5e00">if(A[i]<j) break;</SPAN><BR><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"></SPAN><SPAN style="COLOR: #ff5e00">A[i+1]=A[i];</SPAN><BR><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00">}</SPAN></P> <P><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"></SPAN><SPAN style="COLOR: #ff5e00">A[i+1]=j;</SPAN><BR><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"></SPAN><SPAN style="COLOR: #ff5e00"> m=m-1;</SPAN><BR><SPAN style="COLOR: #ff5e00"> </SPAN><SPAN style="COLOR: #ff5e00"> }</SPAN></P> <P> </P> <P> for(i=0;i<=m;i++)<BR> {<BR> printf("%d",A[i]);<BR> }</P> <P> </P> <P> return 0;<BR>}<BR>---------------------------------------------------------------------------</P> <P>배열을 푸는데</P> <P>여기서 색깔친 부분을 바꿔서</P> <P>출력되는 값이 {1,2,4,5,7}</P> <P>이런식으로 나와야 하는데 반복을 어떻게 해야할지 모르겠네요</P> <P>저 부분을 어떻게 바꿔야 하나요?</P>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.