Answer to Question #303687 in C++ for Imzi

Question #303687

2. Suppose that x, y, and z are int variables, and x = 10, y = 15, and z = 20. Determine



whether the following expressions evaluate to true or false:



a. !(x > 10)



b. x <= 5 || y < 15



c. (x != 5) && (y != z)



d. x >= z || (x + y >= z)



e. (x <= y - 2) && (y >= z) || (z - 2 != 20)



3. Rewrite the following expressions using an if...else statement. (Assume that all variables



are declared properly.)



a. (x < 5) ? y = 10 : y = 20;



b. (fuel >= 10) ? drive = 150 : drive = 30;



c. (booksBought >= 3) ? discount = 0.15 : discount = 0.0;

1
Expert's answer
2022-02-28T01:08:11-0500

2.

a. true

b. false

c. true

d. true

e. true


3.

a. if (x < 5) y = 10; else y = 20;

b. if (fuel >= 10) drive = 150 ; else drive = 30;

c. if (booksBought >= 3) discount = 0.15 ; else discount = 0.0;


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog