In this post I am going to describe the PHP Program which tell us how to find Factorial of a number .Factorial of a number is the product of an integer and all the integers below it eg Factorial of 4 is 4*3*2*1=24 24 is the Factorial of 4.
<?php
if(isset($_POST['submit'])){
$number= $_POST['number'];
$fact=1;
for($i=$number;$i>1;$i--){
$fact=$fact*$i;
}
echo "Factorial of the number is ".$fact;
}
?>
<html>
<head>
<title>Factorial</title>
</head>
<body>
<form action="" method='POST'>
<label for="number">Please Enter a Number</label>
<input type="text" name="number" value="">
<br><br>
<input type="submit" value="Done" name="submit">
</form>
</body>
</html>
Program Output:
Stay tuned for the PHP Magento, WordPress and Magento2 latest tutorial and updates, Hope you enjoyed reading, if you need the professional Magento Development / PHP we can help you, just Click on the Link and send me your requirements.
Please Like the Post on Facebook or Google+.



