title: No of rectangles formed from N square
body: <p>I am solving this question on how many rectangles can be formed from N square of unit length. I came across this formula ⌊3n/2⌋−1 for (n>1) this is wrong formula.
  Can anyone explain this formula and the given code.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;math.h&gt;
  
  int main()
  {
  int i,j,n,cnt=0;
  scanf("%d",&amp;n);
  int k= sqrt(n);
  for(i=1;i&lt;=k;i++)
      for(j=i+1;i*j&lt;=n;j++)
          cnt++;
  cnt+=k;
  printf("%d",cnt);
  return 0;
  }
  </code></pre>