At first, the program I did the calculation using the following expression:
valorComDescontos = valorTotal - (valorTotal * percentual);
Where valorTotal
is a value assigned by the user (a variable), percentual
is a fixed value ( 0.0229
) and valorComDescontos
is the value that will be calculated with INTEREST (% ).
What I am trying to calculate now is this: the user will enter a value and the program should calculate as result the value that having the discounts will have the value entered by the user. By changing the calculation, I came up with the following expression:
valorTotal = valorComDescontos + (valorTotal * percentual)
But since the variable I will not have value is valorTotal* percentual
, 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 calculate 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