Search

Finding Prime number in C#

static bool Primer(ulong x)
{
 bool result = true;
 ulong i = 2;

 while (i <= x / 2)
 {
  if (x % i == 0)
  {
   result = false;
   break;
  }
  else{
   i++;
  }
  if (x % i == 0)
  result = false;
 return result;
 }
}