PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 2: Write a program to check whether the given number is prime or not.

prime.php

<!DOCTYPE html>
<html>
<head>
	<title>PHP Programs TutorialsDuniya.com</title>
</head>
<body>
	<?php
	$num=24;

	echo"<br/> The number is = ".$num;

	for($j=2; $j<$num; $j++)
	{
		if($num%$j==0)
		{
			break;
		}
	}

	echo"<br/>";
	if ($num==$j) 
		echo "Prime Number:", $j, "<br/>";
	else
		echo"It is not A Prime Number";
	?>
</body>
</html>



If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.