Mistři v programování na #hovnokod

PHP #980

Prvočíslo

if (checkInteger ($Number) == TRUE)
{
print ("The Number " . $Number . "is " . checkPrime ($Number) . "\n");
}
else
{
print("ERROR: Number-Typ is NOT integer!");
}


function checkInteger ($Number)
{
  if ($Number > 1)
  {
    return (checkInteger ($Number-1));
  }
  elseif ($Number < 0)
  {
   return (checkInteger ((-1)*$Number-1));
  }
else
{
  if (($Number > 0) AND ($Number < 1))
  {
	return (FALSE)
  }
  else
  {
	return (TRUE)
  }
 }
}

function checkPrime ($Number)
{
  if ($Number < 2) return ("NOT PRIME.");
  elseif (($Number == 2) OR ($Number == 3) OR ($Number == 5) OR ($Number == 7)) return ("PRIME.");
  else
  {
   if     (($Number%2) == 0) return ("NOT PRIME.");
   elseif (($Number%3) == 0) return ("NOT PRIME.");
   elseif (($Number%5) == 0) return ("NOT PRIME.");
   elseif (($Number%7) == 0) return ("NOT PRIME.");
   else return ("PRIME.");
 }
} 

HovnoKod,