Percentage Moves
Halcyon's clients read moves as percentages, never in pounds. A share that fell four means nothing until you know whether it started at forty or at four hundred. The note therefore restates every day's move as a share of the price it started that day from.
Task: Print each day's move as a percentage of the day before.
Input
The first line holds an integer n, always at least 2. Each of the next n lines holds one day's closing price, always greater than zero.
Output
One line for every day after the first — n - 1 lines in all — with exactly one digit after the decimal point. Each move is measured against the previous day's close. A fall prints with a minus sign and a day that closed level prints 0.0.
Example:
Input:
3
100
120
90
Output:
20.0
-25.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