我遇到了以下问题,并从中获得了结果如何从答案中取回原始值。
count = 5000; rate = 5%
deduction_percentage = 5 / 100 (rate / 100)
deduction_percentage = 0.05;
weight deduction = 5000 * 0.05 (count * deduction_percentage)
weight_dedcution = 250
total = 5000 - 250 (count - weight_deduction)
total = 4750
使用此答案4750并率5%如何将原始计数设为5000。
答案 0 :(得分:1)
var count = 5000; var rate = 5; // 5%
var deduction_percentage = 5 / 100; //(rate / 100)
deduction_percentage = 0.05;
var weight_deduction = 5000 * 0.05; //(count * deduction_percentage)
weight_dedcution = 250;
var total = 5000 - 250; // (count - weight_deduction)
total = 4750;
// below line to get back original count.
var original_count = total * 100 / (100 - rate);
console.log(original_count);