강의

멘토링

커뮤니티

Inflearn Community Q&A

gmldnjs355476's profile image
gmldnjs355476

asked

왜 범위를 > 초과 < 미만 으로 설정했는데 경계 값인 10이나 0을 넣어도 puts("end")로 넘어 가는지 모르겠어요

Written on

·

44

0

#include <stdio.h>

int main(void)

{

int nInput = 0;

again:

printf("Enter nInput: ");

scanf_s("%d", &nInput);

if (nInput > 10 || nInput < 0)

{

printf("Enter number 1 ~ 9\n");

goto again;

}

puts("end");

return 0;

}

Answer 1

0

gmldnjs355476님의 프로필 이미지
gmldnjs355476
Questioner

nInput >= 11 했을 때도 10을 넣으면 바로 puts로 넘어가 버려요 왜 그런거죠? 어떤게 빠진건가요

gmldnjs355476's profile image
gmldnjs355476

asked

Ask a question