#K81367. Running Total
Running Total
Running Total
You are given a list of integers. Your task is to compute and output the running total of the list. In other words, for each position ( i ) (1-indexed), compute the cumulative sum ( S_i = \sum_{j=1}^{i} a_j ). The input list can contain positive, negative, or zero values and it may be empty.
Your program should read the input from standard input and write the result to standard output. The result should be output as space-separated integers on a single line.
inputFormat
The first line contains a single integer ( n ) representing the number of elements in the list. The second line contains ( n ) space-separated integers.
outputFormat
Print the running total (cumulative sum) of the list as space-separated integers on one line.## sample
4
1 2 3 4
1 3 6 10