All pastes #733218 Raw Edit

Stuff

public text v1 · immutable
·published 2007-10-11 17:01 UTC
rendered paste body
//1 - true
//0 - false
//input is guaranteed to be positive
//assume the containing module include math
int isPrime(int inVal)
{
  int i;
  int stopVal = (int)(sqrt( (double)inVal ));
  for(i=2; i <= stopVal; i=i+1)
  {
    if !(inVal % i)
    {
      return 0;
    }//end "if inVal % i is zero"
  }//end for loop over inval
   
  return 1;
}//isPrime