0

what if X>10?

if the user input10, how come the result? why is that small? int Y =10; while(true) {String Z=console.readline(); int X= convert.toint32(Z); var Result=(X>10)?"big":"small"; console.writeline(Result);}

8th Mar 2017, 12:17 AM
Tracyzhao
Tracyzhao - avatar
2 odpowiedzi
+ 3
10 is NOT GREATER, and NOT SMALLER than 10. It's like if I have 10 apples, and you have 10 apples. Do I have MORE? No. 10 is EQUAL to 10. So, 10 == 10, 10 >= 10, 10 <= 10, are all TRUE, because of the equality. But, the same two numbers cannot be STRICTLY smaller (<) or STRICTLY greater (>) than each other. And so, 10 < 10, 10 > 10, are both FALSE.
8th Mar 2017, 1:16 AM
Jehad Al-Ansari
Jehad Al-Ansari - avatar
0
<= means less or equal. >= means greater or equal. and == is equal
26th Apr 2017, 10:15 AM
mei
mei - avatar