<?php
$credit = 40000;
$percent = 1.03;
$comission = 1000;
$payment = 5000;
$total = 0;
for ($month = 0; $month <=20; $month ++) {
$credit = $credit * $percent + $comission - $payment;
$total = $total +5000;
if ($credit <= 5000) {
$total = $total + ceil($credit); $month = $month +1;
echo "Последний платеж составит {$credit} рублей\n";
echo "Общая выплаченая сумма составила $total рублей\n";
echo "Срок выплат составил $month месяцев";
break;
}
}
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CiRjcmVkaXQgPSA0MDAwMDsKJHBlcmNlbnQgPSAxLjAzOwokY29taXNzaW9uID0gMTAwMDsKJHBheW1lbnQgPSA1MDAwOwokdG90YWwgPSAwOwogZm9yICgkbW9udGggPSAwOyAkbW9udGggPD0yMDsgJG1vbnRoICsrKSB7CiAJJGNyZWRpdCA9ICRjcmVkaXQgKiAkcGVyY2VudCArICRjb21pc3Npb24gLSAkcGF5bWVudDsKIAkkdG90YWwgPSAkdG90YWwgKzUwMDA7CiAJICBpZiAoJGNyZWRpdCA8PSA1MDAwKSB7CiAJICAJJHRvdGFsID0gJHRvdGFsICsgY2VpbCgkY3JlZGl0KTsKIAkgIAkkbW9udGggPSAkbW9udGggKzE7CiAJICAJJGNyZWRpdCA9IGNlaWwoJGNyZWRpdCk7CiAJICAJZWNobyAi0J/QvtGB0LvQtdC00L3QuNC5INC/0LvQsNGC0LXQtiDRgdC+0YHRgtCw0LLQuNGCIHskY3JlZGl0fSDRgNGD0LHQu9C10LlcbiI7CiAJICAJZWNobyAi0J7QsdGJ0LDRjyDQstGL0L/Qu9Cw0YfQtdC90LDRjyDRgdGD0LzQvNCwINGB0L7RgdGC0LDQstC40LvQsCAkdG90YWwg0YDRg9Cx0LvQtdC5XG4iOwogCSAgCWVjaG8gItCh0YDQvtC6INCy0YvQv9C70LDRgiDRgdC+0YHRgtCw0LLQuNC7ICRtb250aCDQvNC10YHRj9GG0LXQsiI7CiAJICAJYnJlYWs7CiAJICB9Cn0=