RosettaCodeData/Task/Floyds-triangle/Maple/floyds-triangle.maple

32 lines
625 B
Plaintext

floyd := proc(rows)
local num, numRows, numInRow, i, digits;
digits := Array([]);
for i to 2 do
num := 1;
numRows := 1;
numInRow := 1;
while numRows <= rows do
if i = 2 then
printf(cat("%", digits[numInRow], "a "), num);
end if;
num := num + 1;
if i = 1 and numRows = rows then
digits(numInRow) := StringTools[Length](convert(num-1, string));
end if;
if numInRow >= numRows then
if i = 2 then
printf("\n");
end if;
numInRow := 1;
numRows := numRows + 1;
else
numInRow := numInRow +1;
end if;
end do;
end do;
return NULL;
end proc:
floyd(5);
floyd(14);