Wednesday, October 5, 2011

Challenge 021’s Solution

After the code completes, variable x equals 30, while variable y equals 90. The code starts out saying that variable x is an int value of 30, and variable y is an int value of 40. Next, it says that the code will proceed if “x ≥ 0”, which is true. Because this is true, the value for y is changed so that “y = x × 3”, which makes y now equal 90. After that, it says that the code will proceed if “y < 50”, which is false. This “if” statement doesn’t have a counterpart “else” statement, so the code segment is completed with x equaling 30 and y equaling 90.
 
−Phoenix

1 comment: