Task

Compute the sum and product of an array of integers.




An element is a thing with a number.
 
To find a sum and a product of some elements:
Put 0 into the sum.
Put 1 into the product.
Get an element from the elements.
Loop.
If the element is nil, exit.
Add the element's number to the sum.
Multiply the product by the element's number.
Put the element's next into the element.
Repeat.
 
To make some example elements:
If a counter is past 10, exit.
Allocate memory for an element.
Put the counter into the element's number.
Append the element to the example.
Repeat.
 
A product is a number.
 
To run:
Start up.
Make some example elements.
Find a sum and a product of the example elements.
Destroy the example elements.
Write "Sum: " then the sum on the console.
Write "Product: " then the product on the console.
Wait for the escape key.
Shut down.
 
A sum is a number.