<?php
function kappa($creditSum, $payout, $percent, $payment, $payment1){
$creditSum = $creditSum + $payment1;
$paymentTotal = 0;
for($i = 0; $i <666; $i++){
$creditSum = $creditSum * $percent + $payment - $payout;
$paymentTotal = $paymentTotal + $payout;
if($creditSum < 0){
$paymentTotal = $paymentTotal + $creditSum;
break;
}
}
return $paymentTotal;
}
$creditSum = 39999;
$payout = 5000;
$homoCreditTotal = kappa($creditSum, $payout, 1.04, 500, 0);
$softbankTotal = kappa($creditSum, $payout, 1.03, 1000, 0);
$strawberryBankTotal = kappa($creditSum, $payout, 1.02, 0, 7777);
echo "Homocredit: {$homoCreditTotal} руб.\n";
echo "Softbank: {$softbankTotal} руб.\n";
echo "StrawberryBank: {$strawberryBankTotal} руб.\n";
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKZnVuY3Rpb24ga2FwcGEoJGNyZWRpdFN1bSwgJHBheW91dCwgJHBlcmNlbnQsICRwYXltZW50LCAkcGF5bWVudDEpewoJJGNyZWRpdFN1bSA9ICRjcmVkaXRTdW0gKyAkcGF5bWVudDE7CgkkcGF5bWVudFRvdGFsID0gMDsKCWZvcigkaSA9IDA7ICRpIDw2NjY7ICRpKyspewoJCSRjcmVkaXRTdW0gPSAkY3JlZGl0U3VtICogJHBlcmNlbnQgKyAkcGF5bWVudCAtICRwYXlvdXQ7CgkJJHBheW1lbnRUb3RhbCA9ICRwYXltZW50VG90YWwgKyAkcGF5b3V0OwoJCQlpZigkY3JlZGl0U3VtIDwgMCl7CgkJCQkkcGF5bWVudFRvdGFsID0gJHBheW1lbnRUb3RhbCArICRjcmVkaXRTdW07CgkJCQlicmVhazsKCQkJfQoJCX0KCXJldHVybiAkcGF5bWVudFRvdGFsOwp9CQokY3JlZGl0U3VtID0gMzk5OTk7CiRwYXlvdXQgPSA1MDAwOwokaG9tb0NyZWRpdFRvdGFsID0ga2FwcGEoJGNyZWRpdFN1bSwgJHBheW91dCwgMS4wNCwgNTAwLCAwKTsKJHNvZnRiYW5rVG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