#K83092. Cumulative Sum Array
Cumulative Sum Array
Cumulative Sum Array
You are given an array of n integers. Your task is to compute its cumulative sum array. That is, for each index i (1-indexed), the output element is defined as:
\( C_i = \sum_{j=1}^{i} a_j \)
Where \( a_j \) are the elements of the input array. This problem tests your ability to deal with array iteration and prefix sums. Please note that the input is provided through stdin and the output should be written to stdout in the specified format.
inputFormat
The first line contains a single integer n, the number of elements in the array. The second line contains n space-separated integers representing the array.
outputFormat
Output a single line containing n integers – the cumulative sum array. The values should be separated by a single space.
## sample5
1 2 3 4 5
1 3 6 10 15
</p>