The Running Total
Meridian is saving for a second grinder, and the owner wants the wall chart to show progress rather than daily takings. Each line should be everything banked so far, including that day, so the chart tracks the pot rather than bouncing around with the weather. Refund days are in the data and pull the pot back down.
Task: Print the running total after each day.
Input
The first line holds an integer n, the number of days. Each of the next n lines holds one day's takings as a whole number, which may be negative on a day of refunds.
Output
One line per day, n lines in all, each a whole number: everything banked up to and including that day. The first line is just day 1's own figure. No decimal point anywhere.
Example:
Input:
3
5
10
15
Output:
5
15
30
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in