note 52778 added to control-structures.do.while
| From: | bir dot sanasam at majornminor dot com | Date: | Thu, 12 May 2005 09:45:01 +0000 |
| Subject: | note 52778 added to control-structures.do.while | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89307@lists.php.net to get a copy of this message | ||
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>
----
Manual Page -- http://www.php.net/manual/en/control-structures.do.while.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52778
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52778&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52778&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52778&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52778&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52778&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52778&report=yes
Search -- http://master.php.net/manage/user-notes.php