<?php
function getBalanceInFuture($credit, $percent, $comission, $payment, $payout, $total)
{
$total = $total + $credit * $percent + $comission + $payment;
$credit = $credit + $credit * $percent + $comission + $payment - $payout;
for (; $credit >= 0; $credit -= $payout) {
$total = $total + $credit * $percent + $comission;
$credit = $credit + $credit * $percent + $comission;
}
return $total;
}
$homoTotal = getBalanceInFuture(39999, 0.04, 500, 0, 5000, 39999);
$softTotal = getBalanceInFuture(39999, 0.03, 1000, 0, 5000, 39999);
$strawberryTotal = getBalanceInFuture(39999, 0.02, 0, 7777, 5000, 39999);
echo "Школьник будет должен банку {$homoTotal}руб.\n";
echo "Школьник будет должен банку {$softTotal}руб.\n";
echo "Школьник будет должен банку {$strawberryTotal}руб.\n";
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKCmZ1bmN0aW9uIGdldEJhbGFuY2VJbkZ1dHVyZSgkY3JlZGl0LCAkcGVyY2VudCwgJGNvbWlzc2lvbiwgJHBheW1lbnQsICRwYXlvdXQsICR0b3RhbCkKewogICAgCiAgICAkdG90YWwgID0gJHRvdGFsICsgJGNyZWRpdCAqICRwZXJjZW50ICsgJGNvbWlzc2lvbiArICRwYXltZW50OwogICAgJGNyZWRpdCA9ICRjcmVkaXQgKyAkY3JlZGl0ICogJHBlcmNlbnQgKyAkY29taXNzaW9uICsgJHBheW1lbnQgLSAkcGF5b3V0OwogICAgCiAgICBmb3IgKDsgJGNyZWRpdCA+PSAwOyAkY3JlZGl0IC09ICRwYXlvdXQpIHsKICAgICAgICAkdG90YWwgID0gJHRvdGFsICsgJGNyZWRpdCAqICRwZXJjZW50ICsgJGNvbWlzc2lvbjsKICAgICAgICAkY3JlZGl0ID0gJGNyZWRpdCArICRjcmVkaXQgKiAkcGVyY2VudCArICRjb21pc3Npb247CiAgICAgICAgCiAgICB9CiAgICAKICAgIHJldHVybiAkdG90YWw7Cn0KJGhvbW9Ub3RhbCAgICAgICA9IGdldEJhbGFuY2VJbkZ1dHVyZSgzOTk5OSwgMC4wNCwg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