How can I iterate through a two-dimensional array in a snail mode, with a single cycle?
<p>Given a <em>two dimensional array</em>, I would like to iterate through it in a <strong>snail mode</strong> and print out the elements using <strong>one single cycle</strong>.</p>

<p>For example if the given array is:</p>

<pre><code>10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
25 26 27 28 29
30 31 32 33 34
</code></pre>

<p>The program should print out:</p>

<pre><code>10 15 20 25 30 31 32 33 34 29 24 19 14 13 12 11 16 21 26 27 28 23 18 17 22
</code></pre>

<p>So starting from the upper-left corner and arriving to the center of the array.</p>