The function should replace the contents of each cell with


Write a function named "subtotal" takes as its arguments the following:

(1) an array of floating point values;

(2) an integer that tells the number of cells in the array.

The function should replace the contents of each cell with the sum of the contents of all the cells in the original array from the left end to the cell in question. Thus, for example, if the array passed to the function looks like this:

0 1 2 3 4

5.8 | 2.6 | 9.1 | 3.4 | 7.0
then when the function returns, the array will have been changed so that it looks like this:

0 1 2 3 4

5.8 | 8.4 | 17.5 | 20.9 | 27.9

because 5.8 + 2.6 = 8.4 and 5.8 + 2.6 + 9.1 = 17.5 and so on. Note that the contents of cell 0 are not changed. The function should not return a value.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: The function should replace the contents of each cell with
Reference No:- TGS01463270

Expected delivery within 24 Hours