RosettaCodeData/Task/Floyds-triangle/PL-I/floyds-triangle.pli
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

17 lines
522 B
Text

(fofl, size):
floyd: procedure options (main); /* Floyd's Triangle. Wiki 12 July 2012 */
declare (i, m, n) fixed (10), (j, k, w, nr) fixed binary;
put list ('How many rows do you want?');
get list (nr); /* the number of rows */
n = nr*(nr+1)/2; /* the total number of values */
j,k = 1; m = n - nr + 1;
do i = 1 to n;
put edit (i) ( x(1), f(length(trim(m))) );
if k > 1 then do; k = k - 1; m = m + 1; end;
else do; k,j = j + 1; m = n - nr + 1; put skip; end;
end;
end floyd;