#K67877. Cumulative Sum
Cumulative Sum
Cumulative Sum
Given a sequence of integers, compute the cumulative sum array such that each element at index \(i\) is defined as \(S_i = \sum_{j=1}^{i} a_j\). For example, if the input array is [1, 2, 3, 4], then the cumulative sum array is [1, 3, 6, 10].
Input is provided via standard input where the first line contains an integer \(n\) — the number of elements, and the second line contains \(n\) space-separated integers. The output should be the cumulative sums printed on a single line, separated by spaces.
Note: Use LaTeX formatting for mathematical formulas in the problem description.
inputFormat
The first line contains an integer \(n\) — the number of elements.
The second line contains \(n\) space-separated integers.
outputFormat
Output a single line of \(n\) space-separated integers which represent the cumulative sum array.
## sample4
1 2 3 4
1 3 6 10
</p>