Task

Compute the sum and product of an array of integers.




sequence array
integer sum,prod
 
array = { 1, 2, 3, 4, 5 }
 
sum = 0
prod = 1
for i = 1 to length(array) do
  sum += array[i]
  prod *= array[i]
end for
 
printf(1,"sum is %d\n",sum)
printf(1,"prod is %d\n",prod)