<?php
function summa($procent,$komi,$schet){
$deposit=5000.0;
$dolg=1000;
$pereplata=0.0+$schet;
$month=1;
$vsego=0;
for($dolg;$dolg>=0;$month++){
$vsego=$dolg*$procent+$komi;
if ($vsego < $deposit){
$pereplata=$pereplata + $vsego;
break;
}
else{
$dolg = $vsego - $deposit;
$pereplata=$pereplata + $deposit;}
}
return $pereplata;
}
$homoCredit = summa(1.04,500,0);
$softCredit = summa(1.03,1000,0);
$yagodaCredit = summa(1.02,0,7000);
echo "\n $homoCredit\n";
echo " $softCredit\n";
echo " $yagodaCredit\n";
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKZnVuY3Rpb24gc3VtbWEoJHByb2NlbnQsJGtvbWksJHNjaGV0KXsKJGRlcG9zaXQ9NTAwMC4wOwokZG9sZz0xMDAwOwokcGVyZXBsYXRhPTAuMCskc2NoZXQ7CiRtb250aD0xOwokdnNlZ289MDsKZm9yKCRkb2xnOyRkb2xnPj0wOyRtb250aCsrKXsKCSR2c2Vnbz0kZG9sZyokcHJvY2VudCska29taTsKCWlmICgkdnNlZ28gPCAkZGVwb3NpdCl7CgkKCSRwZXJlcGxhdGE9JHBlcmVwbGF0YSArCSR2c2VnbzsKCWJyZWFrOwkKCX0KCWVsc2V7CgkkZG9sZyA9ICR2c2VnbyAtICRkZXBvc2l0OwoJCgkkcGVyZXBsYXRhPSRwZXJlcGxhdGEgKwkkZGVwb3NpdDt9CgkKCQp9CnJldHVybiAkcGVyZXBsYXRhOwp9CgkkaG9tb0NyZWRpdCA9IHN1bW1hKDEuMDQsNTAwLDApOwoJJHNvZnRDcmVkaXQgPSBzdW1tYSgxLjAzLDEwMDAsMCk7CgkkeWFnb2RhQ3JlZGl0ID0gc3VtbWEoMS4wMiwwLDcwMDApOwoJCgllY2hvICJcbiAkaG9tb0NyZWRpdFxuIjsKCWVjaG8gIiAkc29mdENyZWRpdFxuIjsKCWVjaG8gIiAkeWFnb2RhQ3JlZGl0XG4iOw==