Sha256: 382f6eeb89d73fcdaaeb687edfbac7a01b454b62d87703dc92658b6e32cad0ac
Contents?: true
Size: 351 Bytes
Versions: 17
Compression:
Stored size: 351 Bytes
Contents
<?php function nfact($n) { if ($n == 0) { return 1; } else { return $n * nfact($n - 1); } } echo "\n\nPlease enter a whole number ... "; $num = trim(fgets(STDIN)); // ===== PROCESS - Determing the factorial of the input number ===== $output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n"; echo $output; ?>
Version data entries
17 entries across 17 versions & 1 rubygems