도대체 왜 안되는지 모르겠네요.for문,if문,goto문
꽃내음
2023.04.01
도대체 왜 안되는지 모르겠네요.for문,if문,goto문아무이상없이 컴파일도 잘되는데 내용이 안나옵니다.질문 내용 :
#include stdio.h
int count;
int index;
int n=50;
int k=3;
int main(void)
{
index=0;
int planet[50]={0,};
int procedure[50]={0,};
for(int i=1;i=50;i++)
{
count=0;
for(int j=1;;j++)
{
index=index+j;
if(index50)
{index=index-50;}
if(planet[index]==0)
{
count=count+1;
}
if(count==3)
{goto next;}
}
next:
planet[index]=i;
procedure[i]=index;
count=0;
}
printf(마지막사형수:%d번 사형수,procedure[50]);
}
사형수 50명을 3번사형수부터 시작해 6번 사형수..9,12,....,48, 이런식으로 사형시키는건데요, 마지막 사형수가 누가되는지
마지막에 출력을 하는건데. 도무지 아무것도 나오지를 않네요.
꽤나 골똘히 생각하고 코드썼거든요 봐도 봐도 뭐가 문젠지 모르겠어요..
도우ㅏ주세요 ㅠㅠ