fork(1) download
  1. <?php
  2.  
  3.  
  4. function Credit($credit, $pay, $percent, $tax, $payForBill) {
  5. $total = 0;
  6. $credit += $payForBill;
  7. for ($month = 1; $month < 30; $month ++){
  8.  
  9. $credit = $credit * $percent + $tax;
  10.  
  11. if ($credit < $pay) {
  12. $total += $credit;
  13. break;
  14. }
  15. else {
  16. $credit -= $pay;
  17. $total += $pay;
  18. }
  19. }
  20. return $total;
  21. }
  22.  
  23. $creditSum = 39999;
  24. $payout = 5000;
  25. $homoCreditTotal = Credit($creditSum, $payout, 1.04, 500, 0);
  26. $softbankTotal = Credit($creditSum, $payout, 1.03, 1000, 0);
  27. $strawberryBankTotal = Credit($creditSum, $payout, 1.02, 0, 7777);
  28.  
  29. echo "homoCredit: {$homoCreditTotal}\n";
  30. echo "softbank: {$softbankTotal}\n";
  31. 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