Task

Compute the sum and product of an array of integers.




/* NetRexx */
 
options replace format comments java crossref savelog symbols binary
 
harry = [long 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 
sum = long 0
product = long 1
entries = Rexx ''
 
loop n_ = int 0 to harry.length - 1
  nxt = harry[n_]
  entries = entries nxt
  sum = sum + nxt
  product = product * nxt 
  end n_
 
entries = entries.strip
 
say 'Sum and product of' entries.changestr(' ', ',')':'
say '     Sum:' sum
say ' Product:' product
 
return
 