04 Try it yourself Interactive
Set the marked price, the final selling price and the first discount. The console finds the intermediate price, divides to recover the second discount, and then cross-checks the pair against the overall discount. If a combination is impossible — a selling price higher than the first discount alone would allow — it says so rather than returning a negative discount.