fork download
  1. <?php
  2.  
  3. function totalPay($monthPay, $tax, $creditSum, $bankPercent, $bankName) {
  4. for ($month = 1; $month <= 20; $month++) {
  5. $creditSum = ($creditSum * $bankPercent) + $tax - $monthPay;
  6. $total = $total + $monthPay;
  7. if ($creditSum < 0) {
  8. $monthPay = $creditSum;
  9. $total = $total + $monthPay;
  10. $creditSum = $creditSum - $monthPay;
  11. $month = $month + 1;
  12. echo "Анон платит {$month} месяцев. Заплатит {$total} банку {$bankName}.\n";
  13. break;
  14. }
  15. }
  16. }
  17.  
  18. $oneTimeTax = 7777;
  19. $homoCredit = totalPay(5000, 500, 999, 1.04, 'HOMOCREDIT');
  20. $softBank = totalPay(5000, 1000, 999, 1.03, 'SOFTBANK');
  21. $strawberryBank = totalPay(5000, 0, 999, 1.02, 'STRAWBERRYBANK') + $oneTimeTax;
  22.  
  23.  
  24. echo "{$homoCredit}\n";
  25. echo "{$softBank}\n";
  26. echo "{$strawberryBank}\n";
Success #stdin #stdout #stderr 0.02s 24400KB
stdin
Standard input is empty
stdout
Анон платит 2 месяцев. Заплатит 1538.96 банку HOMOCREDIT.
Анон платит 2 месяцев. Заплатит 2028.97 банку SOFTBANK.
Анон платит 2 месяцев. Заплатит 1018.98 банку STRAWBERRYBANK.


7777
stderr
PHP Notice:  Undefined variable: total in /home/Ka9bBR/prog.php on line 7
PHP Notice:  Undefined variable: total in /home/Ka9bBR/prog.php on line 7
PHP Notice:  Undefined variable: total in /home/Ka9bBR/prog.php on line 7