Answer Posted / akvh
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="" method="post">
Enter the number: <input type="text" name="num" />
<input type="submit" name="sub" />
</form>
<?php
if(isset ($_POST['sub']))
{
$a=$_POST['num'];
$i=2;
$f=0;
while($i<=($a/2))
{
if($a%$i==0)
{
$f=1;
break;
}
$i++;
}
if($f==1)
{
echo "NOT PRIME";
}
else
{
echo "PRIME";
}
}
?>
</body>
</html>
| Is This Answer Correct ? | 13 Yes | 1 No |
Post New Answer View All Answers
Which will check if a function exists?
How to write in a file in php?
How to initiate a session in php?
Explain what is the difference between for and foreach?
Is apache needed for php?
What does the unset() function mean?
Where php basically used?
How many records can be stored in mysql table?
Which character is used to match exactly one character?
What is difference between rest api and restful api?
How to write the form tag correctly for uploading files?
What is constructor and destructor?
How long will it take to learn php?
What is the advantage of runtime polymorphism?
Why super () is used in java?