Sum of elements below main diagonal of matrix: Difference between revisions

Added R.
(Corrected text)
(Added R.)
Line 978:
{{Out}}
<pre>69</pre>
 
=={{header|R}}==
R has lots of native matrix support, so this is trivial.
<lang R>mat <- rbind(c(1,3,7,8,10),
c(2,4,16,14,4),
c(3,1,9,18,11),
c(12,14,17,18,20),
c(7,1,3,9,5))
print(sum(mat[lower.tri(mat)]))</lang>
{{out}}
<pre>[1] 69</pre>
 
=={{header|Raku}}==
331

edits