<?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;
} else {
$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";
PD9waHAKCi8vIElQQUQKCmVycm9yX3JlcG9ydGluZygtMSk7CgpmdW5jdGlvbiBjYWxjdWxhdGVUb3RhbFBheW1lbnRzKCRjcmVkaXRTdW0sICRwYXlvdXQsICRwZXJjZW50LCAkc2VydmljZVBheW1lbnQpewoJCgkkdG90YWxQYXltZW50cyA9IDA7CgkKCWZvciAoJG1vbnRoID0gMTsgJG1vbnRoIDwgMjA7ICRtb250aCsrKXsKCQkkY3JlZGl0U3VtID0gKCRjcmVkaXRTdW0gKiAkcGVyY2VudCkgKyAkc2VydmljZVBheW1lbnQ7CgkJaWYgKCRjcmVkaXRTdW0gPCAkcGF5b3V0KSB7CgkJCSRwYXlvdXQgPSAkY3JlZGl0U3VtOwoJCQkkY3JlZGl0U3VtIC09ICRwYXlvdXQ7CgkJfSBlbHNlIHsKCQkJJGNyZWRpdFN1bSAtPSAkcGF5b3V0OwoJCX0KCgkJJHRvdGFsUGF5bWVudHMgKz0gJHBheW91dDsKCQkKCQlpZiAoJGNyZWRpdFN1bSA9PSAwKSB7CgkJCWJyZWFrOwoJCX0KCX0KCQoJcmV0dXJuICR0b3RhbFBheW1lbnRzOwoKfQoKJGNyZWRpdF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