Evenly Splitting a Range
The charting library at Riverbend Supply draws a value axis for every dashboard tile. Whoever configures a tile picks the lowest and highest value the axis should span, plus how many labelled marks it should carry. Both ends always get a mark — an axis whose top value is left unlabelled looks broken to the people reading it.
Task: Print the positions of the tick marks along the axis.
Input
One line holding three values separated by single spaces: the low end of the axis, the high end, and how many marks it carries. The first two may be decimals and may be negative; the third is a whole number and is at least 2.
Output
One line holding that many positions, separated by single spaces, smallest first, each with two digits after the decimal point. Neighbouring marks are all the same distance apart, the first position is the low end exactly, and the last is the high end exactly.
Example:
Input:
0 10 5
Output:
0.00 2.50 5.00 7.50 10.00
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