<?php
$credit = 40000;
$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 < ($platez - $komis)) {
$credit - $platez;
echo "Долг меньше {$platez}. Осталось заплатить $credit \n";
$summa + $credit;
echo "Уплачено $summa \n";
break;
}
}
?>
PD9waHAKCiRjcmVkaXQgPSA0MDAwMDsKJHByb2MgPSAxLjAzOwoka29taXMgPSAxMDAwOwokcGxhdGV6ID0gNTAwMDsKJHN1bW1hID0gMDsKJG9zdGF0b2sgPSAkY3JlZGl0IC0gJHBsYXRlejsKCmZvciAoJG1vbnRoID0gMTsgJG1vbnRoIDw9IDIwOyAkbW9udGgrKykgeyAKICAgICAgICAgICRjcmVkaXQgPSAoJGNyZWRpdCAqICRwcm9jKSArICRrb21pcyAtICRwbGF0ZXo7CiAgICAgICAgICAkc3VtbWEgPSAkc3VtbWEgKyAkcGxhdGV6OwogICAgICAgICAgZWNobyAi0J3QsCB7JG1vbnRofSDQvNC10YHRj9GGINC00L7Qu9CzOiB7JGNyZWRpdH0g0YDRg9CxLCDQstGL0L/Qu9Cw0YfQtdC90L46IHskc3VtbWF9IFxuIjsKCiAgICBpZiAoJGNyZWRpdCA8ICgkcGxhdGV6IC0gJGtvbWlzKSkgewogICAgJGNyZWRpdCAtICRwbGF0ZXo7CiAgICBlY2hvICLQlNC+0LvQsyDQvNC10L3RjNGI0LUgeyRwbGF0ZXp9LiDQntGB0YLQsNC70L7RgdGMINC30LDQv9C70LDRgtC40YLRjCAkY3JlZGl0IFxuIjsKICAgICRzdW1tYSArICRjcmVkaXQ7CiAgICBlY2hvICLQo9C/0LvQsNGH0LXQvdC+ICRzdW1tYSBcbiI7CiAgICBicmVhazsKICAgIH0KfQo/Pg==