<?php
function credit($summa, $persent, $plusVMesyac , $nachalniyVznos, $plataVMes) {
for ($i = 1; $i <= 1000; $i++) {
$skolkoViplatil = 0;
$vsyaSumma = $summa + $nachalniyVznos;
$vsyaSumma = ($summa * $persent + $plusVMesyac);
if($vsyaSumma>$plataVMes){
$vsyaSumma = $vsyaSumma - $plataVMes;
} else {
$plataVMes = $vsyaSumma;
$vsyaSumma = $vsyaSumma - $plataVMes;
}
$skolkoViplatil = $skolkoViplatil + $plataVMes;
if ($vsyaSumma <= 0){
break;
}
}
}
$creditsum - 39999;
$payount = 5000;
$homoCreditTotal = credit($creditsum, 1.04, 500, 0, $payount);
$softBankTotal = credit($creditsum, 1.03, 1000, 0, $payount);
$strawberryBankTotal = credit($creditsum, 1.02, 0, 7777, $payount);
echo $homoCreditTotal;
echo $softBankTotal;
echo $strawberryBankTotal;
PD9waHAKCmVycm9yX3JlcG9ydGluZyAoLTEpOwoKZnVuY3Rpb24gY3JlZGl0KCRzdW1tYSwgJHBlcnNlbnQsICRwbHVzVk1lc3lhYyAsICRuYWNoYWxuaXlWem5vcywgJHBsYXRhVk1lcykgewoJZm9yICgkaSA9IDE7ICRpIDw9IDEwMDA7ICRpKyspIHsKCQkkc2tvbGtvVmlwbGF0aWwgPSAwOwoJCSR2c3lhU3VtbWEgID0gJHN1bW1hICsgJG5hY2hhbG5peVZ6bm9zOwoJCSR2c3lhU3VtbWEgPSAoJHN1bW1hICogJHBlcnNlbnQgKyAkcGx1c1ZNZXN5YWMpOwoJCQoJCQoJCWlmKCR2c3lhU3VtbWE+JHBsYXRhVk1lcyl7CgkkdnN5YVN1bW1hID0gJHZzeWFTdW1tYSAtICRwbGF0YVZNZXM7CiAgICAgICAgfSBlbHNlIHsKCSRwbGF0YVZNZXMgPSAkdnN5YVN1bW1hOwoJJHZzeWFTdW1tYSA9ICR2c3lhU3VtbWEgLSAkcGxhdGFWTWVzOwoJfQoJJHNrb2xrb1ZpcGxhdGlsID0gJHNrb2xrb1ZpcGxhdGl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