Tuesday, July 29, 2014

Finding factorial values in php

<html>
<body>
<form name="hi" method="POST" action="factorial.php">
<input type="text" name="t1">
<br>
<br>
<input type="submit" value="submit">
</form>
<?php
$tot=1;
$num=$_POST['t1'];
for($i=$num;$i>0;$i--)
{
$tot=$tot*$i;
echo"<br>";
}
echo $tot;
?>
</body>
</html>

above code works well to find factorial....no error will occur

No comments:

Post a Comment