2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 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