fork(1) download
  1. <?php
  2.  
  3.  
  4. function getFinalPrice ($credit, $pay, $loanRate, $comission){
  5. $totalPay = 0;
  6. while ($credit > 0):
  7. $credit = $credit * (1 + $loanRate/100) + $comission - $pay;
  8. $totalPay += $pay;
  9. endwhile;
  10. $totalPay += $credit;
  11. return $totalPay;
  12. }
  13.  
  14.  
  15. $homoCreditTotal = getFinalPrice(39999, 5000, 4, 500);
  16. $softBankTotal = getFinalPrice(39999, 5000, 3, 1000);
  17. $strawberryBankTotal = getFinalPrice(47776, 5000, 2, 0);
  18.  
  19.  
  20. echo "HomoCredit: $homoCreditTotal руб.\n";
  21. echo "SoftBank: $softBankTotal руб.\n";
  22. echo "StrawberryBank: $strawberryBankTotal руб.\n";
Success #stdin #stdout 0.02s 52480KB
stdin
Standard input is empty
stdout
HomoCredit: 56423.563121625 руб.
SoftBank: 61268.718210807 руб.
StrawberryBank: 53559.8738592 руб.