title: How does this "print a heart" program work in C?
body: <p>I stumbled across this code on some blog over the internet. It's a pretty interesting program, but I've been trying to figure out how the program actually works for a while and I've been stuck at it since then. I just don't get how the program prints the symmetry. Is one half of the heart printed and the other half replicated by mirroring it?  If anyone can help me figure out the logic, I'd appreciate it. Thanks in advance. </p>
  
  <pre><code>//Include Headers.
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  int main()
  {
      int x, y, size=20;
      for (x=0; x&lt;size; x++)
      {
          for (y=0; y&lt;=4*size; y++)
          {
              double dist1 = sqrt( pow(x-size,2) + pow(y-size,2) );
              double dist2 = sqrt( pow(x-size,2) + pow(y-3*size,2) );
              if (dist1 &lt; size + 0.5 || dist2 &lt; size + 0.5 )
                   printf("%c",97);
              else
                   printf(" ");
          }
          printf("\n");
      }
      for (x = 1; x &lt;= 2*size; x++)
      {
          for (y=0; y&lt;x; y++)
          printf(" ");
          for (y=0; y&lt;4*size + 1 - 2*x; y++)
              printf("%c",86);
          printf("\n");
      }
  
      return 0;  
  }
  </code></pre>