Is there any alternative/simplified formula on deducting multiple percentage of a number from itself?

66 Views Asked by At

EDIT: Sorry for the unclear description of what I really wanted. I have completely rewritten my question to make it clearer..

On a specific software I am creating, I want to know if there is an alternative formula on finding x here:

d = a / 100
e = b / 100
f = c / 100
g = z - (z * d)
h = g - (g * e)
x = h - (h * f)

The values of a, b, c and z are user inputted. For example, if a=5, b=4, c=3 and z=100:

d = 0.05
e = 0.04
f = 0.03
g = 95
h = 91.2
x = 88.464

Can you guys suggest of a simpler/alternative formula to find x?

EDIT: The purpose of this formula is to apply a certain discount to a product price. For example, if product's price is \$100, and 5/4/3% discount is applied, the new product price should be \$88.464

3

There are 3 best solutions below

2
On BEST ANSWER

User enters $N $ and $x/y/z $.

Return $N *(1-\frac x {100})*(1-\frac y{100})*(1-\frac z {100}) $

This is assuming you actually wanted $[1 - x - y (1-x)-z (1-y (1-x))]100 $ and not $1-x -xy-xyz $ (which yields 94.794 instead of 88.464).

If you did want the other

Return $N (1-\frac x {100}-\frac {xy} {100^2}-\frac {xyz}{100^3}) $.

3
On

By your example:

Suppose we want to find the $a/b/c$ percent of a number $n $, then the new number, $n_1$ is given by, $$n_1 =n -\frac {an}{100} - \frac {b}{100}[\frac {an}{100}] - \frac {c}{100}[\frac {b}{100}[\frac {an}{100}]] $$ $$\Rightarrow n_1 =n [1- \frac {a}{10^2} - \frac {ab}{10^4} - \frac {abc}{10^6}] $$

EDIT:

Just backtracking the expressions gives us the new number as: $$x =z [1-d-e-f+de+ef+df-efd] $$

Hope it helps.

3
On

Your solution is wrong. In second step

5% of 100 = 5. Not 95.

And try this -

Take 5% of 100 common from last three terms,

100 - 5% of 100 [ 1 + 4% + 3% × 4%]

= 100 - 5 [ 1 + 0.04 + 0.0012]

= 100 - 5 [ 1.0412]

= 100 - 5.206 = 94.794