Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main()
- {
- int i, sc;
- int rm;
- srand(time(NULL));
- rm=rand()%30;
- printf("컴퓨터가 생각하는 숫자 = %d\n",rm); //Temp Code
- start:
- printf("숫자입력(1부터 30까지) : ");
- scanf("%d",&sc);
- if(sc==rm){printf("정답입니다!\n"); i++; goto last;}
- else if(sc>rm){printf("%d보다 작습니다!\n",sc); i++; goto start;}
- else if(sc<rm){printf("%d보다 큽니다!\n",sc); i++; goto start;}
- else {printf("error"); goto end;}
- last:
- printf("시도한 횟수는 %d회 입니다.\n",i);
- end:
- return 0;
- }
Add Comment
Please, Sign In to add comment