<?php
function getBalanceInFuture($credit,$percent,$comission,$payment,$payout,$total) {
for ($i=$credit;$i>=0;$i-=$payout) {
if ($payment==7777) {
$total= $total + $credit * $percent + $comission + $payment;
$credit = $credit + $credit * $percent + $comission + $payment;
$payment++;}
else {
$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";
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKIApmdW5jdGlvbiBnZXRCYWxhbmNlSW5GdXR1cmUoJGNyZWRpdCwkcGVyY2VudCwkY29taXNzaW9uLCRwYXltZW50LCRwYXlvdXQsJHRvdGFsKSB7Cglmb3IgKCRpPSRjcmVkaXQ7JGk+PTA7JGktPSRwYXlvdXQpIHsKICAgIGlmICgkcGF5bWVudD09Nzc3NykgewogICAgJHRvdGFsPSAkdG90YWwgKyAkY3JlZGl0ICogJHBlcmNlbnQgKyAkY29taXNzaW9uICsgJHBheW1lbnQ7CiAgICAkY3JlZGl0ID0gJGNyZWRpdCArICRjcmVkaXQgKiAkcGVyY2VudCArICRjb21pc3Npb24gKyAkcGF5bWVudDsKICAgIAogICAgJHBheW1lbnQrKzt9CiAgICBlbHNlIHsgCiAgICAkdG90YWw9ICR0b3RhbCArICRjcmVkaXQgKiAkcGVyY2VudCArICRjb21pc3Npb247CiAgICAkY3JlZGl0ID0gJGNyZWRpdCArICRjcmVkaXQgKiAkcGVyY2VudCArICRjb21pc3Npb247CiAgICAKICAgIH0KCX0KCXJldHVybiAkdG90YWw7Cn0KJGhvbW9Ub3RhbD0gZ2V0QmFsYW5jZUluRnV0dXJlKDM5OTk5LDAuMD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