isprime(int a)
{
int I;
for(I = 2; I & lta;; i++)
{
If (a%i==0)
Returns 0;
other
Returns1;
}
}
In the following references
int isprime (int x)
{
for(int I = 2; I< = sqrt (x); I++) //i as long as it is less than the square of X.
If (0 == x%i) // Jump out of the loop directly when x is divided by i and remains 0.
Break;
If (I < = sqrt (x))
Returns 0;
other
Returns1;
}