Matrix with two diagonals: Difference between revisions
Content added Content deleted
(Add Mathematica/Wolfram Language implementation) |
m (Added Easylang) |
||
Line 1,023: | Line 1,023: | ||
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|EasyLang}}== |
|||
{{trans|Nim}} |
|||
<syntaxhighlight> |
|||
proc matrix side . . |
|||
for i to side |
|||
for j to side |
|||
if i = j or i = side - j + 1 |
|||
write "1 " |
|||
else |
|||
write "0 " |
|||
. |
|||
. |
|||
print "" |
|||
. |
|||
. |
|||
matrix 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> |
|||
=={{header|Excel}}== |
=={{header|Excel}}== |