RosettaCodeData/Task/Compile-time-calculation/PL-I/compile-time-calculation-1.pli
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

26 lines
433 B
Text

/* Factorials using the pre-processor. */
test: procedure options (main);
%factorial: procedure (N) returns (fixed);
declare N fixed;
declare (i, k) fixed;
k = 1;
do i = 2 to N;
k = k*i;
end;
return (k);
%end factorial;
%activate factorial;
declare (x, y) fixed decimal;
x = factorial (4);
put ('factorial 4 is ', x);
y = factorial (6);
put skip list ('factorial 6 is ', y);
end test;