RosettaCodeData/Task/Catalan-numbers/PL-I/catalan-numbers.pli
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

19 lines
393 B
Text

catalan: procedure options (main); /* 23 February 2012 */
declare (i, n) fixed;
put skip list ('How many catalan numbers do you want?');
get list (n);
do i = 0 to n;
put skip list (c(i));
end;
c: procedure (n) recursive returns (fixed decimal (15));
declare n fixed;
if n <= 1 then return (1);
return ( 2*(2*n-1) * c(n-1) / (n + 1) );
end c;
end catalan;