fork download
  1. <?php
  2.  
  3.  
  4. $credit = 40000;// сумма
  5. $percent = 1.03;// процент
  6. $tax = 1000;
  7. $max = 5000;// сколько школьник может платить за месяц
  8. $total = 0;
  9.  
  10. for ($i = 1; $credit > 0; $i ++)
  11. {//начало цикла
  12.  
  13. if (($credit * $percent + $tax) < $max)
  14. {// начало IF
  15.  
  16. $max = $credit * $percent + $tax;
  17.  
  18. }// конец IF
  19.  
  20. $credit = ($credit * $precent + $tax) - $max;
  21. $total = $total + $max;
  22.  
  23. echo "месяц $i, выплачено $total\n";
  24.  
  25. }//конец цикла
Success #stdin #stdout #stderr 0s 82880KB
stdin
Standard input is empty
stdout
месяц 1, выплачено 5000
stderr
PHP Notice:  Undefined variable: precent in /home/8TwN66/prog.php on line 21