AlexRow,
function calculateProfit(amount, percent, period) {
let sum = 0;
for (let i = 0; i < period; i++) {
let delta = amount * percent / 100;
sum += delta;
amount += delta;
}
return Math.floor(sum);
}
console.log(calculateProfit(1000, 5, 7)); //407
console.log(calculateProfit(12500, 3, 12)); //5322
console.log(calculateProfit(0, 3, 1)); //0
console.log(calculateProfit(100000, 3, 1)); //3000