Summing Columns of a Sales Table
The same weekly table from Riverbend Supply, laid out the same way: one line per shop, three trading days across, in day order. This time head office is asking the other question. It is choosing which day of the week to run next month's promotion on, so it wants the takings of the whole chain on each of the three days — the shops matter only as contributors.
Task: Print the chain's takings for each of the three days, in day order.
Input
The first line holds a single integer n, the number of shops. Each of the next n lines holds three sales figures separated by single spaces, in day order. Every figure is a whole number of dollars.
Output
One line holding three totals, in day order, separated by single spaces. Write each as a whole number: no decimal point, no brackets, no commas.
Example:
Input:
2
10 20 30
5 5 5
Output:
15 25 35
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