Matrix with two diagonals: Difference between revisions
Content added Content deleted
(→{{header|Ruby}}: Add Ruby) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 5: | Line 5: | ||
<br> If you can please use GUI |
<br> If you can please use GUI |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|Wren}} |
|||
<syntaxhighlight lang="11l"> |
|||
F two_diagonal_matrix(n) |
|||
L(i) 0 .< n |
|||
L(j) 0 .< n |
|||
print(I i == j | i + j == n - 1 {1} E 0, end' ‘ ’) |
|||
print() |
|||
two_diagonal_matrix(6) |
|||
print() |
|||
two_diagonal_matrix(7) |
|||
</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 |
|||
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|Ada}}== |
=={{header|Ada}}== |