12 lines
277 B
Text
12 lines
277 B
Text
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;
|