Four friends share the fuel of a road trip. Write the algorithm first, then the program RoadTrip.
INPUT distance (km), kmPerLitre, pricePerLitre, people
litres ← distance / kmPerLitre
cost ← litres × pricePerLitre
share ← cost / people
OUTPUT litres, cost, share
For the input
460 14.5 7.8 4
the program prints (two decimals, with printf)
Fuel needed: 31.72 litres
Cost of the trip: 247.45
Share of each of the 4 people: 61.86