<?php
function bank ($sumCredit, $percent, $gross, $pay, $onePay){
$ending = 0;
for ($mounth = 1; $mounth <= 25; $mounth ++){
if ($sumCredit > $pay){
$sumCredit = ($sumCredit * $percent) + $gross - $pay;
}
else{
$pay = $sumCredit * $percent;
$sumCredit = 0;
}
$ending = $ending + $pay;
}
return $ending;
}
$sumCredit = 39999;
$pay = 5000;
$homoCreditTotal = bank ($sumCredit, 1.04, 500, $pay, 0);
$softBankTotal = bank ($sumCredit, 1.03, 1000, $pay, 0);
$strawBerryBankTotal = bank ($sumCredit, 1.02, 0, $pay, 7777);
echo "HomoCredit Bank: {$homoCreditTotal} рублей \n";
echo "Soft Bank: {$softBankTotal} рублей \n";
echo "StrawBerry Bank: {$strawBerryBankTotal} рублей \n";
/*
$sumCredit - сумма кредита
$percent - проценты
$gross - комиссия
$pay - платеж
$onePay - доп платеж банка StrawBerry
*/
PD9waHAKZXJyb3JfcmVwb3J0aW5nICgtMSk7CgpmdW5jdGlvbiBiYW5rICgkc3VtQ3JlZGl0LCAkcGVyY2VudCwgJGdyb3NzLCAkcGF5LCAkb25lUGF5KXsKCSRlbmRpbmcgPSAwOwoJZm9yICgkbW91bnRoID0gMTsgJG1vdW50aCA8PSAyNTsgJG1vdW50aCArKyl7CgkJaWYgKCRzdW1DcmVkaXQgPiAkcGF5KXsKCQkJJHN1bUNyZWRpdCA9ICgkc3VtQ3JlZGl0ICogJHBlcmNlbnQpICsgJGdyb3NzIC0gJHBheTsKCQl9CgkJZWxzZXsKCQkJJHBheSA9ICRzdW1DcmVkaXQgKiAkcGVyY2VudDsKCQkJJHN1bUNyZWRpdCA9IDA7CgkJfQoJJGVuZGluZyA9ICRlbmRpbmcgKyAkcGF5OwoJfQoJcmV0dXJuICRlbmRpbmc7Cn0KCiRzdW1DcmVkaXQgPSAzOTk5OTsKJHBheSA9IDUwMDA7CiRob21vQ3JlZGl0VG90YWwgPSBiYW5rICgkc3VtQ3JlZGl0LCAxLjA0LCA1MDAsICRwYXksIDApOwokc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