comparison true false -7 = 17 X 17 > -1 X 17 <= -1 X 2 < 4 X 2 >= 2 X 17 <> 17 X
In an IF
statement,
the true or false of a relational expression
picks whether the true branch or the false branch of code
is executed.
Here is another story problem:
A clothing store wants a program that calculates the tax on an item. Clothing that costs $100 or more has a 5% tax. Clothing that costs less than $100 is tax free. Write a program that asks for the price, then calculates the tax and prints it out.
Here is a start:
PRINT "Please enter the clothing price:" INPUT PRICE ' IF ______________ THEN PRINT "The tax is:", PRICE * 0.05 ' true branch ELSE PRINT "There is no tax" ' false branch END IF ' END
Complete the program by filling in the blank.