Code

The following pseudocode snippet describes a segment of a computer program. What value of Y is displayed?
SET Y = 30
SET X = 3
While X ≥ 2
Y = Y*X
X = X - 1
End While
Print Y

Hint
The code is running a loop. $$X$$ increases incrementally every time the code cycles through.
Hint 2
Factor in the exit criteria for the loop to end. Track the $$X$$ and $$Y$$ values for each cycle.
The code is running a loop. $$X$$ increases incrementally every time the code cycles through. Although the exit criteria is based on $$X$$ , we’ll need to track both $$X$$ and $$Y$$ for every cycle. Running through the script logically:
Loop is exited once $$X = 1$$ . When $$X = 1$$ , $$Y = 180$$ . Thus, the value of $$Y$$ that is printed is 180.
180