Matrix with two diagonals: Difference between revisions

Content added Content deleted
imported>Maxima enthusiast
No edit summary
(→‎BQN: add)
Line 642: Line 642:
0 1 0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0 1 0
1 0 0 0 0 0 0 0 0 1</pre>
1 0 0 0 0 0 0 0 0 1</pre>

=={{header|BQN}}==
<syntaxhighlight lang="bqn">D2 ← ∨⟜⌽∾˜⥊+⟜1↑×

D2 7</syntaxhighlight>
{{out}}
<pre>┌─
╵ 1 0 0 0 0 0 1
0 1 0 0 0 1 0
0 0 1 0 1 0 0
0 0 0 1 0 0 0
0 0 1 0 1 0 0
0 1 0 0 0 1 0
1 0 0 0 0 0 1
┘</pre>


=={{header|C}}==
=={{header|C}}==