update
Former-commit-id: bdede6ed1b6f578f2ef046c338caf02d0b29d453 [formerly 7187de361b]
Former-commit-id: 447d58460fbbfd05ffe08428a1288e392637561d
This commit is contained in:
1 parent
d9c268e3a4
commit
0afb9e732c
1580 files changed
+453021
-6
No files matched your search
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user