Wakey wakey

Here’s a quick puzzle to wake up a programmer’s brain…

What is the output of the following when X is initially 0, and when X is initially 1?

X = initialValue; Y = 6; while (X++ < --Y) { /* Do Nothing */ } print X;

Work it out in your head. No cheating! And no, I’m not giving you the answer. It’s intended to wake you up! :)

Categorised as: Coding

Comment Free Zone

Comments are closed.