How to calculate effective percentage on total with each quatintiy increase?

173 Views Asked by At

I am developing an application in which user buys a product of fixed price. Here is the scenario:

If the user buys only one quantity of the product then no discount

If the user buys 2 items of the product then 10% discount. If the user buys 3 items of the product then 10% more discount on amount calculated after quantity 2.

For example:

The product costs USD100 and user bought only 1 quantity then he pays USD100. The product costs USD100 and user bought 2 quantities then he pays USD180 (USD200-USD20) due to 10% discount. Now if the user buys 3 quantities then he pays USD261 like this USD180+USD100=USD280. USD280*10%=USD28

Hence payable amount is USD280-USD28=USD252.

The overall discount percentage with 3 quantities purchased is 16%.

Is there a formula that I can use to get the effective percentage if I just provide it the quantity and product price?

Thank you for the help.