note 52778 deleted from control-structures.do.while by didou
| From: | didou@php.net | Date: | Thu, 12 May 2005 12:33:23 +0000 |
| Subject: | note 52778 deleted from control-structures.do.while by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-89314@lists.php.net to get a copy of this message | ||
Note Submitter: bir dot sanasam at majornminor dot com
Reason: bad code
----
i m a fresher in PHP but i want this then i think that by the following programme will give u some
knowledge if you r also fresher.
<html>
<head><title>prime</title></head>
<body>
<?php
if(isset($_POST['posted'])){
$count=2;
do
{
$remainder = $_POST['guess'] % $count;
$count = $count + 1;
}while ($remainder != 0 and $count < $_POST['guess']);
if($count < $_POST['guess'] || ($_POST['guess'] == 0) ||
($_POST['guess'] == 1))
{
echo "<br><br><b>Your number is not prime</b><hr>";
}
else
{
echo "<br><br><b>Your number is prime</b><hr>";
}
}
?>
<br><br>
<center><form method="POST" action="checkprime.php">
<input type="hidden" name="posted" value="true">
What is your number:
<input name="guess" type="text">
<br><br>
<input type="submit" value="Check is number is prime">
<br><br>
</form></center>
</body>
</html>