Matrix with two diagonals: Difference between revisions
Content added Content deleted
m (→{{header|RPL}}: typos / page layout) |
(Cr) |
||
Line 2,150: | Line 2,150: | ||
(1,7) 1 |
(1,7) 1 |
||
(7,7) 1 |
(7,7) 1 |
||
</pre> |
|||
=={{header|Nim}}== |
|||
<syntaxhighlight lang="Nim">proc drawMatrix(side: Positive) = |
|||
let last = side - 1 |
|||
for i in 0..<side: |
|||
for j in 0..<side: |
|||
stdout.write if i == j or i == last - j: "1 " else: "0 " |
|||
echo() |
|||
drawMatrix(6) |
|||
</syntaxhighlight> |
|||
{{out]] |
|||
<pre>1 0 0 0 0 1 |
|||
0 1 0 0 1 0 |
|||
0 0 1 1 0 0 |
|||
0 0 1 1 0 0 |
|||
0 1 0 0 1 0 |
|||
1 0 0 0 0 1 |
|||
</pre> |
</pre> |
||