title: Print out an ASCII circle of the specified width
body: <p>I'm trying to change the following code so I get this output for radius 2:</p>
  <pre><code>  *****
  ***   ***
  **     **
  ***   ***
    *****
  </code></pre>
  <p>Any help will be appreciated as I'm about to go crazy!</p>
  <pre class="lang-java prettyprint-override"><code>public class Main {
      public static void main(String[] args) {
          // dist represents distance to the center
          double dist;
          double radius = 2;
  
          // for horizontal movement
          for (int i = 0; i &lt;= 2 * radius; i++) {
              // for vertical movement
              for (int j = 0; j &lt;= 2 * radius; j++) {
                  dist = Math.sqrt(
                          (i - radius) * (i - radius) +
                          (j - radius) * (j - radius));
  
                  // dist should be in the range (radius - 0.5)
                  // and (radius + 0.5) to print stars(*)
                  if (dist &gt; radius - 0.5 &amp;&amp; dist &lt; radius + 0.5)
                      System.out.print(&quot;*&quot;);
                  else
                      System.out.print(&quot; &quot;);
              }
              System.out.println(&quot;&quot;);
          }
      }
  }
  </code></pre>