Given the Selling price i.e ‘SP’ of the two items each. One item is sold at ‘P%’ Profit and other at ‘P%’ Loss. The task is to find out the overall Loss.
Input: SP = 2400, P = 30% Output: Loss = 474.725 Input: SP = 5000, P = 10% Output: Loss = 101.01
How does the above formula work?
For profit making item :
With selling price (100 + P), we get P profit.
With selling price SP, we get SP * (P/(100 + P)) profit
For loss making item :
With selling price (100 – P), we get P loss.
With selling price SP, we get SP * (P/(100 – P)) loss
Net Loss = Total Loss – Total Profit
= SP * (P/(100 – P)) – SP * (P/(100 + P))
= (SP * P * P * 2) / (100*100 – P*P)
Note: The above formula is applicable only when the Cost price of both the items are different. If CP of both the items are same then, in that case, there is ‘No profit No loss’.
Below is the implementation of the above approach
Loss = 474.725
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.