200k views
2 votes
The following code is intended to test if x is NOT less than 17. Fill in the correct symbol:

if (x ____ 17):

User Will Chu
by
6.4k points

2 Answers

7 votes

There are “two ways” where you can fill the necessary symbol.

Method 1:

if(x>17): This will check whether the given value of ‘x’ is greater than 17. Suppose if you want to include 17 also then you must write if(x>=17).

Method 2:

if(!(x<17)): This conditional statement checks whether the value of x is not less than 15. We use both “comparison operator” and a “not operator” to achieve the given statement through programming constructs.

Here the trick is that, we place a false statement (x<17) and then invert that value to get the desired condition.

User Mayuresh Patil
by
6.2k points
4 votes

Answer:

if(x>17): This will check whether the given value of ‘x’ is greater than 17. Suppose if you want to include 17 also then you must write if(x>=17).

Step-by-step explanation:

User Vince Carter
by
5.8k points