fork(4) download
  1. <?php
  2.  
  3. function bank ($sumCredit, $percent, $gross, $pay, $onePay){
  4. $ending = 0;
  5. for ($mounth = 1; $mounth <= 25; $mounth ++){
  6. if ($sumCredit > $pay){
  7. $sumCredit = ($sumCredit * $percent) + $gross - $pay;
  8. }
  9. else{
  10. $pay = $sumCredit * $percent;
  11. $sumCredit = 0;
  12. }
  13. $ending = $ending + $pay;
  14. }
  15. return $ending;
  16. }
  17.  
  18. $sumCredit = 39999;
  19. $pay = 5000;
  20. $homoCreditTotal = bank ($sumCredit, 1.04, 500, $pay, 0);
  21. $softBankTotal = bank ($sumCredit, 1.03, 1000, $pay, 0);
  22. $strawBerryBankTotal = bank ($sumCredit, 1.02, 0, $pay, 7777);
  23.  
  24. echo "HomoCredit Bank: {$homoCreditTotal} рублей \n";
  25. echo "Soft Bank: {$softBankTotal} рублей \n";
  26. echo "StrawBerry Bank: {$strawBerryBankTotal} рублей \n";
  27.  
  28. /*
  29. $sumCredit - сумма кредита
  30. $percent - проценты
  31. $gross - комиссия
  32. $pay - платеж
  33. $onePay - доп платеж банка StrawBerry
  34. */
  35.  
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
HomoCredit Bank: 55923.563121625 рублей 
Soft Bank: 59260.891466803 рублей 
StrawBerry Bank: 44029.365496746 рублей