Friday, January 1, 2016

function getFactoril


<?php
function getFactorial($number)
{
    $fn = 1;
    for($i = 1; $i <= $number; $i++)
        $fn = $fn * $i;
    return $fn;
}

if(isset($_POST['submit'])){


$fn = $_POST['factorial'];

echo "<h1>Factorial Number of  $fn  =" . getFactorial($fn) . "</h1>";
}
else{
echo "<h3>Nothing Found ! Please Input Number To Calculate Factorial</h3>"

No comments:

Post a Comment