
Array Summary Place


Create a table of integer positive numbers, even A, a number of N positions (N = known) in which values will be entered in the interval [0-99] with the necessary validity checks.
Considering a known number M (M> 100):
1. Create two new Tables B and C:
a. Table B will include those positions in the original table in which the sum of the data becomes greater than M. When such a position is located, the calculations for the remainder of the table will be made from the beginning, including the current position.
b. Table C will include the corresponding values of the sums as they arise from the relative process.
2. Display the contents of Tables B and C as well as the mean value of the elements in Table C.
Example: for N=14,M=110
Initial array A:
PLACE | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
VALUE | 11 | 45 | 20 | 32 | 99 | 34 | 27 | 77 | 11 | 55 | 89 | 72 | 65 | 59 |
New array B:
5 | 6 | 8 | 11 | 12 | 14 |
11+45+20+32+99=207>110, 99+34=133>110, 34+27+77=138>110 etc
New array C:
277 | 133 | 138 | 182 | 161 | ... | ... |