<p>So I'm self-studying with the Barron's book, right? And I realized something.</p>
<p>I am absolutely terrible at following loops. I can get them, but it usually takes a very long time, and often times I get an answer that's not one of the choices.</p>
<p>Anywho, if anyone has any strategies/tips/shortcuts for reading through loops, feel free to share them here! I'm sure a moderate number of people have the same problem that I have, and you'd be doing society a great favor by sharing your godly knowledge.</p>
<h1>I'll even give you an example you can talk through (ignore the dashes--CC doesn't like keeping the correct spacing).</h1>
<p>Consider this incredibly annoying code segment:</p>
<p>int x = 10, y = 0;
while (x > 5)
{
---y = 3;
---while (y < x)
---{
------y *= 2;
------if (y % x == 1)
--------y += x;
---}
---x -= 3;
}
System.out.println(x + " " + y);</p>
<p>What will be output after execution of this code segment?
(A) 1 6
(B) 7 12
(C) -3 12
(D) 4 12</p>
<h1>(E) -3 6</h1>
<p>The answer is (D).
Any tips on how to do this in a reasonably timely manner?</p>