Profit and loss is percentage applied to trade. Everything is measured on the cost price unless the question says otherwise, and this single habit prevents most errors. Profit = SP - CP, and profit percent = profit / CP x 100.
Discount, by contrast, is always calculated on the marked price. A shopkeeper who marks goods 40% above cost and then offers a 20% discount still earns a profit: SP = 1.40 x 0.80 x CP = 1.12 CP, which is a 12% gain.
The classic trap is the false-weight question. A trader who sells at cost price but uses a 900 g weight for a kilogram earns 100/9 = 11.11% profit, because the effective cost is lower than claimed.