Zig-zag matrix: Difference between revisions
→{{header|ALGOL 68}}: Produce the same output regardless of whether formatted transput is used or not
m (→{{header|Wren}}: Minor tidy) |
(→{{header|ALGOL 68}}: Produce the same output regardless of whether formatted transput is used or not) |
||
Line 401:
{{works with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release 1.8.8d.fc9.i386}}
<syntaxhighlight lang="algol68">
PROC zig zag = (INT n)[,]INT: (
PROC move = (REF INT i, j)VOID: (
IF j < n THEN
Line 435 ⟶ 436:
[,]INT result = zig zag(dim);
FOR i TO dim DO
print((
FOR j TO dim DO
print(( whole( result[i,j], -3 ), IF j /= dim THEN "," ELSE "" FI ))
OD;
print((IF i = dim THEN "))" ELSE ")," FI, new line))
OD
#FI#
{{out}}
(( 0, 1, 5, 6, 14),
( 2, 4, 7, 13, 15),
Line 450 ⟶ 452:
( 10, 18, 19, 23, 24))
</pre>
▲</pre>
=={{header|ALGOL W}}==
|