<?php
function computeCredit($percent, $comission){
$percent = 39999 / 100 * $percent;
$paySum = 0;
for ($creditSum = 39999; $creditSum > 0; $paySum = $paySum + 5000) {
$creditSum = ($creditSum + ($percent + $comission)) - 5000;
if ($creditSum <= 5000){
$paySum = $paySum + $creditSum;
$creditSum = $creditSum - $creditSum;
}
}
return $paySum;
}
$homoCreditTotal = computeCredit(4, 500);
$softbankTotal = computeCredit(3, 1000);
$strawberryBankTotal = computeCredit(2, 0) + 7777;
echo "homoCredit: {$homoCreditTotal} рублей \n";
echo "softBank: {$softbankTotal} рублей \n";
echo "strawberryBank: {$strawberryBankTotal} рублей \n";
?>
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CgpmdW5jdGlvbiBjb21wdXRlQ3JlZGl0KCRwZXJjZW50LCAkY29taXNzaW9uKXsKCSRwZXJjZW50ID0gMzk5OTkgLyAxMDAgKiAkcGVyY2VudDsKCSRwYXlTdW0gPSAwOwoJZm9yICgkY3JlZGl0U3VtID0gMzk5OTk7ICRjcmVkaXRTdW0gPiAwOyAkcGF5U3VtID0gJHBheVN1bSArIDUwMDApIHsKCQkkY3JlZGl0U3VtID0gKCRjcmVkaXRTdW0gKyAoJHBlcmNlbnQgKyAkY29taXNzaW9uKSkgLSA1MDAwOwoJCWlmICgkY3JlZGl0U3VtIDw9IDUwMDApewoJCQkkcGF5U3VtID0gJHBheVN1bSArICRjcmVkaXRTdW07CgkJCSRjcmVkaXRTdW0gPSAkY3JlZGl0U3VtIC0gJGNyZWRpdFN1bTsKCQl9Cgl9CglyZXR1cm4gJHBheVN1bTsKfQoKJGhvbW9DcmVkaXRUb3RhbCA9IGNvbXB1dGVDcmVkaXQoNCwgNTAwKTsKJHNvZnRiYW5rVG90YWwgPSBjb21wdXRlQ3JlZGl0KDMsIDEwMDApOwokc3RyYXdiZXJyeUJhbmtUb3RhbCA9IGNvbXB1dGVDcmVkaXQoMiwgMCkgKyA3Nzc3OwoKZWNobyAiaG9tb0NyZWRpdDogeyRob21vQ3JlZGl0VG90YWx9INGA0YPQsdC70LXQuSBcbiI7CmVjaG8gInNvZnRCYW5rOiB7JHNvZnRiYW5rVG90YWx9INGA0YPQsdC70LXQuSBcbiI7CmVjaG8gInN0cmF3YmVycnlCYW5rOiB7JHN0cmF3YmVycnlCYW5rVG90YWx9INGA0YPQsdC70LXQuSBcbiI7Cgo/Pg==