Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Floyds-triangle/Maple/floyds-triangle.maple
Normal file
31
Task/Floyds-triangle/Maple/floyds-triangle.maple
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue