title: Perfect square or not?
body: <p>This is a code to check if a number is perfect square or not. Why does it work ?</p>
  
  <pre><code>static bool IsSquare(int n)
  {
      int i = 1;
      for (; ; )
      {
          if (n &lt; 0)
              return false;
          if (n == 0)
              return true;
          n -= i;
          i += 2;
      }
  }
  </code></pre>