Actually, the sequence is:
n = 0 to start
loopcount = 1
First while loop, n = 0, n < 4, n is incremented to 1
n += 2 * loopcount, n = 3
Back to the while loop, n = 3, n < 4, n is incremented to 4
n += 2 * loopcount, n = 6
Back to the while loop, n = 6, n > 4, n is incremented to 7, break while loop
Next in for loop, loopcount is now 2
Into the while loop, n = 7, n > 4, n is incremented to 8, break while loop
Next in for loop, loopcount is now 3
Into the while loop, n = 8, n > 4, n is incremented to 9, break while loop
Next in for loop, loopcount is now 4, loopcount > 3, break for loop
Done.