Built in prime checking function
<p>Does C++ have any built in function to check if the number is prime or not. If yes, then in which library?</p>

<p>Below is my implementation. But was just looking if there is any built in function. Searching on Google just gives user based implementations.</p>

<pre><code>int isprime(int N){
    if(N&lt;2 || (!(N&amp;1) &amp;&amp; N!=2))
        return 0;
    for(int i=3; i*i&lt;=N; i+=2){
        if(!(N%i))
            return 0;
    }
    return 1;
}
</code></pre>
