RosettaCodeData/Task/Factorial/PL-I/factorial.pli

13 lines
277 B
Text
Raw Permalink Normal View History

2013-04-10 22:43:41 -07:00
factorial: procedure (N) returns (fixed decimal (30));
declare N fixed binary nonassignable;
declare i fixed decimal (10);
declare F fixed decimal (30);
if N < 0 then signal error;
F = 1;
do i = 2 to N;
F = F * i;
end;
return (F);
end factorial;