RosettaCodeData/Task/Multiplication-tables/Picat/multiplication-tables.picat
2023-07-01 13:44:08 -04:00

25 lines
378 B
Text

go =>
N=12,
make_table(N),
nl.
%
% Make a table of size N
%
make_table(N) =>
printf(" "),
foreach(I in 1..N) printf("%4w", I) end,
nl,
println(['-' : _ in 1..(N+1)*4+1]),
foreach(I in 1..N)
printf("%2d | ", I),
foreach(J in 1..N)
if J>=I then
printf("%4w", I*J)
else
printf(" ")
end
end,
nl
end,
nl.