Check prime or not number check in the php

technical talkiess
0

Check prime or not number check in the php 


<!DOCTYPE html>

<html>

<body>


<?php

function checkPrime($number){

if($number == 1){

return 0;

}


for($i=2;$i<=$number /2 ;$i++){

if($number%$i == 0){

return 0;

}

return 1;

}

}

if(checkPrime(14)){

echo "Prime Number";

}else{

echo "Not Prime Number";

}

?> 


</body>

</html>


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)