Factorial: Difference between revisions

→‎{{header|PL/0}}: Added a solution.
(→‎{{header|PL/0}}: Added a solution.)
Line 7,654:
Compute another factorial of the number minus 1. \ recursion
Put the other factorial times the number into the factorial.</syntaxhighlight>
 
=={{header|PL/0}}==
The program waits for ''n''. Then it displays ''n''!.
<syntaxhighlight lang="pascal">
var n, f;
begin
? n;
f := 1;
while n <> 0 do
begin
f := f * n;
n := n - 1
end;
! f
end.
</syntaxhighlight>
2 runs.
{{in}}
<pre>5</pre>
{{out}}
<pre> 120</pre>
{{in}}
<pre>7</pre>
{{out}}
<pre> 5040</pre>
 
=={{header|PL/I}}==
Line 7,668 ⟶ 7,693:
return (F);
end factorial;</syntaxhighlight>
 
 
=={{header|PL/SQL}}==
512

edits