factorial of number in while loop

an anonymous user · May 12, 2023
<?php
$f=1;
$n=8;
$i=$n;
while ($i>=1)
{
    $f=$f*$i;
    $i--;
}
    echo"factorial of  $n is $f"."\n";
?>
Output

Comments

Please sign up or log in to contribute to the discussion.