fork(3) download
  1. <?php
  2.  
  3.  
  4. function computeCredit($percent, $comission){
  5. $percent = 39999 / 100 * $percent;
  6. $paySum = 0;
  7. for ($creditSum = 39999; $creditSum > 0; $paySum = $paySum + 5000) {
  8. $creditSum = ($creditSum + ($percent + $comission)) - 5000;
  9. if ($creditSum <= 5000){
  10. $paySum = $paySum + $creditSum;
  11. $creditSum = $creditSum - $creditSum;
  12. }
  13. }
  14. return $paySum;
  15. }
  16.  
  17. $homoCreditTotal = computeCredit(4, 500);
  18. $softbankTotal = computeCredit(3, 1000);
  19. $strawberryBankTotal = computeCredit(2, 0) + 7777;
  20.  
  21. echo "homoCredit: {$homoCreditTotal} рублей \n";
  22. echo "softBank: {$softbankTotal} рублей \n";
  23. echo "strawberryBank: {$strawberryBankTotal} рублей \n";
  24.  
  25. ?>
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
homoCredit: 67298.48 рублей 
softBank: 68598.61 рублей 
strawberryBank: 54975.82 рублей