c 언어 어디가 잘못된 걸까요?

ansdyd64의 이미지

The purpose of the following program is to check input. It is only supposed to accept a value between 0 and 20, and it should continually ask for input until the correct numbers are entered. However, there is a bug in it.

#include

#define TRUE 1
#define FALSE 0

int main(void)
{
int correct, inputint;

inputint = -1;
correct = FALSE;
while (!correct) {
if (0 < inputint < 20) {
printf("Thank you.\n");
correct = TRUE;
} else {
printf("Enter an integer ");
printf("between 0 and 20: ");
scanf("%d", &inputint);
}
}
return 0;
}

a. Fix the bug so that the program behaves as stated above.

영어책 문제 인데요.
숫자적어야 하는 부분이 나오고 그 뒤에
판별해야 하는건 알겠는데 어디를 어떻게 바꿔야 할지
모르겠습니다.

wjddndyd401의 이미지

inputint 값에 상관없이 결과가 항상 true로 나옵니다.
0 < inputint -> 0 or 1
0 or 1 < 20 -> true

0 < inputint && inputint < 20 과 같은 식으로 써야 합니다.

세벌의 이미지

소스코드 넣을 때는 https://kldp.org/node/158191 참고하시고,
영어 번역 해달라는 얘긴 아니겠죠?
0 < inputint < 20
이런 표현을 수학책에서는 일반적으로 쓰는데,
C 프로그램언어에서는

0 < inputint && inputint < 20

또는

inputint > 0 && inputint < 20

이런 식으로 씁니다.

ansdyd64의 이미지

감사합니다!!