Sum and product of an array: Difference between revisions
→{{header|Lasso}}: add Lasso sum and product or an array example
m (→{{header|GAP}}) |
(→{{header|Lasso}}: add Lasso sum and product or an array example) |
||
Line 805:
julia> prod(1:5)
120</lang>
=={{header|Lasso}}==
<lang Lasso>local(x = array(1,2,3,4,5,6,7,8,9,10))
// sum of array elements
'Sum: '
with n in #x
sum #n
'\r'
// product of arrray elements
'Product: '
local(product = 1)
with n in #x do => { #product *= #n }
#product</lang>
{{out}}
<pre>Sum: 55
Product: 3628800</pre>
=={{header|Liberty BASIC}}==
<lang lb>Dim array(19)
|