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 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((result[IF i,], new= 1 THEN "((" ELSE " (" lineFI));
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#
#FI#</syntaxhighlight>
{{out}}
</pre>
{|border="1" style="border-collapse: collapse; border: 5px double grey;"
|align=center width=50%| With formatted transput possible, e.g. [[ALGOL 68G]]
|align=center| '''not''' formatted transput possible, e.g. [[ELLA ALGOL 68]]
|-
|align=center|<pre>
(( 0, 1, 5, 6, 14),
( 2, 4, 7, 13, 15),
Line 450 ⟶ 452:
( 10, 18, 19, 23, 24))
</pre>
||<pre>
+0 +1 +5 +6 +14
+2 +4 +7 +13 +15
+3 +8 +12 +16 +21
+9 +11 +17 +20 +22
+10 +18 +19 +23 +24
</pre>
|}
 
=={{header|ALGOL W}}==
3,038

edits