<?php
$factor=1;
$num=0;
echo "Ingrese un numero entero positivo\n";
$num= (int) trim(fgets(STDIN));
while ($num>1) {
    $factor=$factor*$num;
    $num=$num-1;
}
echo "El factorial del numero es: $factor\n";
?>

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: