Php Script For Factorial Numbers



For Factorial Numbers First we have to create a html Page for entering the number

(factorial.html)
<html>
<body bgcolor="orange">
<h1 style="color:white"> Factorial Number</h1>
<form method="POST" action="fact.php">
<p style="font-family:comic sans ms;color:white;font-size:40px">Enter Number:<input type="number" name="n1" >
<br>
<input type="submit" value="enter">
</form>
</body>
</html>









Next We Have to embed Php File into form  Tag

<?php
$a=$_POST["n1"]; 
echo "$a","<br>"; 
$fact=1; 

for($i=1;$i<=$a;$i++) { 

$fact=$fact*$i; 
 }
echo "Factorial is: $fact"; 
?>

      
                                                       




Comments