<?php
$credit = 1000;
$proc = 1.03;
$komis = 1000;
$platez = 5000;
$summa = 0;
$ostatok = $credit - $platez;
for ($month = 1; $month <= 20; $month++) {
$credit = ($credit * $proc) + $komis - $platez;
$summa = $summa + $platez;
echo "На {$month} месяц долг: {$credit} руб, выплачено: {$summa} \n";
if (($credit + $proc + $komis) < $platez) {
$credit = $platez - ($credit + $komis + $procent);
echo "Долг меньше {$platez}. На следующий месяц, осталось заплатить $credit \n";
$summa = $summa + $credit;
$summa = round($summa, 2); echo "Уплачено $summa \n";
break;
}
}
?>
ICAgIDw/cGhwCiAgICAgCiAgICAkY3JlZGl0ID0gMTAwMDsKICAgICRwcm9jID0gMS4wMzsKICAgICRrb21pcyA9IDEwMDA7CiAgICAkcGxhdGV6ID0gNTAwMDsKICAgICRzdW1tYSA9IDA7CiAgICAkb3N0YXRvayA9ICRjcmVkaXQgLSAkcGxhdGV6OwogICAgIAogICAgZm9yICgkbW9udGggPSAxOyAkbW9udGggPD0gMjA7ICRtb250aCsrKSB7CiAgICAkY3JlZGl0ID0gKCRjcmVkaXQgKiAkcHJvYykgKyAka29taXMgLSAkcGxhdGV6OwogICAgJHN1bW1hID0gJHN1bW1hICsgJHBsYXRlejsKICAgIGVjaG8gItCd0LAgeyRtb250aH0g0LzQtdGB0Y/RhiDQtNC+0LvQszogeyRjcmVkaXR9INGA0YPQsSwg0LLRi9C/0LvQsNGH0LXQvdC+OiB7JHN1bW1hfSBcbiI7CiAgICAgCiAgICBpZiAoKCRjcmVkaXQgKyAkcHJvYyArICRrb21pcykgIDwgJHBsYXRleikgewogICAgICAkY3JlZGl0ID0gJHBsYXRleiAtICgkY3JlZGl0ICsgJGtvbWlzICsgJHByb2NlbnQpOwogICAgCiAgICBlY2hvICLQlNC+0LvQsyDQvNC10L3RjNGI0LUgeyRwbGF0ZXp9LiDQndCwINGB0LvQtdC00YPRjtGJ0LjQuSDQvNC10YHRj9GGLCDQvtGB0YLQsNC70L7RgdGMINC30LDQv9C70LDRgtC40YLRjCAkY3JlZGl0IFxuIjsKICAgICRzdW1tYSA9ICRzdW1tYSArICRjcmVkaXQ7CiAgICAkc3VtbWEgPSByb3VuZCgkc3VtbWEsIDIpOwogICAgZWNobyAi0KPQv9C70LDRh9C10L3QviAkc3VtbWEgXG4iOwogICAgYnJlYWs7CiAgICB9CiAgICB9CgogICAgPz4=