Matrix with two diagonals: Difference between revisions

no edit summary
(Added Arturo implementation)
No edit summary
Line 2,467:
1 0 0 0 0 1
</pre>
 
=={{header|Vlang}}==
{{trans|go}}
<lang vlang>fn special_matrix(n int) {
for i in 0.. n {
for j in 0..n {
if i == j || i+j == n-1 {
print("1 ")
} else {
print("0 ")
}
}
println('')
}
}
fn main() {
special_matrix(6) // even n
println('')
special_matrix(5) // odd n
}</lang>
{{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 1
0 1 0 1 0
0 0 1 0 0
0 1 0 1 0
1 0 0 0 1</pre>
 
=={{header|Wren}}==
338

edits