Day-over-Day Change
Meridian's manager reads the cup counts as a column of numbers and cannot see any movement in them. What she wants on the wall is the movement itself: how much each day gained or lost against the day before, so that a bad Wednesday arrives as a number instead of as a slightly smaller entry she has to notice.
Task: Print the change from one day to the next.
Input
The first line holds an integer n, always at least 2. Each of the next n lines holds one day's cup count.
Output
One line for every day after the first — n - 1 lines in all — each with exactly one digit after the decimal point. A line is that day measured against the day before it, so a fall prints with a minus sign and a day that held level prints 0.0. Day 1 has nothing before it and produces no line.
Example:
Input:
3
100
110
105
Output:
10.0
-5.0
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