3
Doubt is in mathematics, a calculation that will be used in a program.
Let’s assume I have 3 items with different percentages:
Item 1 - 10%
Item 2 - 40%
Item 3 - 50%
I want to remove for example 10% of Item 3 and distribute this percentage in the other two proportionally, generating the following result:
Item 1 - 12%
Item 2 - 48%
Item 3 - 40%
Does anyone have any idea of the calculation or how I get the result?
In what programming language will do this?
– Sergio
I will do in javascript
– user4919
There are always 3 items, and the distribution is always from the third to the other two?
– bfavaretto
There is no order @bfavaretto, I can remove or add any item, and the added/removed amount I have to redistribute proportionally
– user4919