IsPrimeNumber() function

SurajRane
Posted by SurajRane under C# category on | Views : 4077
This is very simple code rather than writing complex code
whch we were used to write during our colllage days :)

public static bool IsPrimeNumber(int number)
{
if (number == 0 || number == 1)
return false;

if (number == 2 || number == 3)
return true;

int square = number * number;

if (square % 24 == 1 )
return true;

return false;
}

Comments or Responses

Login to post response