0
At first, the program I made the calculation using the following expression:
valorComDescontos = valorTotal - (valorTotal * percentual);
Where the valorTotal
is a value assigned by the user (a variable), the percentual
is a fixed value (0.0229
) and the valorComDescontos
is the amount that will be calculated with the INTEREST (valorTotal* percentual
).
What I am trying to calculate now is the following: the user will enter a value and the program will calculate as a result the value having the discounts will have the value entered by the user. Changing the calculation, I came to the following expression:
valorTotal = valorComDescontos + (valorTotal * percentual)
But as the variable I will not have value is the valorTotal
, it could not be on both sides of the expression. How to calculate this?
Example (Previously):
valorTotal = 1000; #valor que o usuário inseriu
percentual = 0.0229; #valor FIXO
valorComDescontos = 1000 - (1000 * 0.0229);
valorComDescontos = 1000 - 22,9;
valorComDescontos = 977,1;
Example (How to be calculated now):
valorComDescontos = 1000; #valor que seria dado pelo usuário
percentual = 0.0229; #valor FIXO
valorTotal = 1023,44; #seria esse o valor aproximado, onde descontando o percentual, chegaria ao valorComDescontos
For mathematical calculations I use this framework https://ncalc.codeplex.com/ Give a look, it is very good and I believe it meets your need
– Diego Silva Lima