Is doing a square root once slower than squaring n times?
<p>I was just looking at some algorithms for prime numbers and came across this:</p>

<pre><code>for(int i=2;i*i &lt;= n;i++)
{/*assume no operations here*/} 
</code></pre>

<p>I was just wondering if the above loop will be faster than the following or not?</p>

<pre><code>int x=sqrt(n);
for(int i=2;i&lt;=x;i++)
{/*nop*/}
</code></pre>
