<?php
// IPAD
function calculateTotalPayments($creditSum, $payout, $percent, $servicePayment){
$totalPayments = 0;
for ($month = 1; $month < 20; $month++){
$creditSum = ($creditSum * $percent) + $servicePayment;
if ($creditSum < $payout) {
$payout = $creditSum;
}
$creditSum -= $payout;
$totalPayments += $payout;
if ($creditSum <= 0) {
break;
}
}
return $totalPayments;
}
$creditSum = 39999;
$payout = 5000;
$homoCreditTotal= calculateTotalPayments($creditSum, $payout, 1.04, 500);
$softbankTotal= calculateTotalPayments($creditSum, $payout, 1.03, 1000);;
$strawberryBankTotal=calculateTotalPayments($creditSum + 7777, $payout, 1.02, 0);;
echo "homoCredit: {$homoCreditTotal} руб.\n";
echo "softbank: {$softbankTotal} руб.\n";
echo "strawberryBank: {$strawberryBankTotal} руб.\n";
PD9waHAKCi8vIElQQUQKCmVycm9yX3JlcG9ydGluZygtMSk7CgpmdW5jdGlvbiBjYWxjdWxhdGVUb3RhbFBheW1lbnRzKCRjcmVkaXRTdW0sICRwYXlvdXQsICRwZXJjZW50LCAkc2VydmljZVBheW1lbnQpewoJCgkkdG90YWxQYXltZW50cyA9IDA7CgkKCWZvciAoJG1vbnRoID0gMTsgJG1vbnRoIDwgMjA7ICRtb250aCsrKXsKCQkkY3JlZGl0U3VtID0gKCRjcmVkaXRTdW0gKiAkcGVyY2VudCkgKyAkc2VydmljZVBheW1lbnQ7CgkJaWYgKCRjcmVkaXRTdW0gPCAkcGF5b3V0KSB7CgkJCSRwYXlvdXQgPSAkY3JlZGl0U3VtOwoJCX0KCQkkY3JlZGl0U3VtIC09ICRwYXlvdXQ7CgoJCSR0b3RhbFBheW1lbnRzICs9ICRwYXlvdXQ7CgkJCgkJaWYgKCRjcmVkaXRTdW0gPD0gMCkgewoJCQlicmVhazsKCQl9Cgl9CgkKCXJldHVybiAkdG90YWxQYXltZW50czsKCn0KCiRjcmVkaXRTdW0gPSAzOTk5OTsKJHBheW91dCA9IDUwMDA7CgokaG9tb0NyZWRpdFRvdGFsPSBjYWxjdWxh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