title: Where is the code wrong?
body: <p>I'm trying to solve this problem from the UVA Online Judge: <a href="http://uva.onlinejudge.org/index.php?option=onlinejudge&amp;page=show_problem&amp;problem=2456" rel="nofollow">http://uva.onlinejudge.org/index.php?option=onlinejudge&amp;page=show_problem&amp;problem=2456</a></p>
  
  <h3>The problem statement</h3>
  
  <blockquote>
    <p>A square number is an integer number whose square root is also an integer. For example 1, 4, 81 are
    some square numbers. Given two numbers a and b you will have to find out how many square numbers
    are there between a and b (inclusive).</p>
  </blockquote>
  
  <h3>The code I've attempted:</h3>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      long long int num1, num2, count = 0;
      int t, i;
  
      while (1)
      {
          count = 0;
          scanf("%lld%lld", &amp;num1, &amp;num2);
  
          if (num1 == 0 &amp;&amp; num2 == 0)
              break;
          for (; num1 * num1 &lt;= num2; num1 ++)
              count++;
  
          printf("%lld\n", count);
      }
  
      return 0;
  }
  </code></pre>
  
  <h3>The Judge's Response</h3>
  
  <p>The Online submission process tells me that my code produces the wrong answer, but I'm not able to figure out why. Can anyone see the error in my code?</p>