fork(2) download
  1. <?php
  2.  
  3.  
  4. function total ($priseIpad, $payStart, $percent, $mounthPay, $comission)
  5. {
  6. $creditSum = ($priseIpad + $payStart);
  7. $paid = 0;
  8.  
  9. for($creditSum = ($creditSum * $percent); $creditSum > 0;)
  10. {
  11. $creditSum = $creditSum + $comission;
  12. if($creditSum > $mounthPay)
  13. {
  14. $paid = $paid + $mounthPay;
  15. $creditSum = $creditSum - $mounthPay;
  16. }
  17.  
  18. else($creditSum < $mounthPay);
  19. {
  20. $paid = $paid + $creditSum;
  21. $creditSum = $creditSum - $creditSum;
  22. }
  23. return $paid;
  24. }
  25.  
  26. }
  27.  
  28. $creditSum = 39999;
  29. $mounthPay = 5000;
  30.  
  31. $homoPer = 1.04;
  32. $homoCom = 500;
  33.  
  34. $homoCredit = total ($creditSum,0,$homoPer,$mounthPay, $homoCom);
  35.  
  36. $softPer = 1.03;
  37. $softCom = 1000;
  38.  
  39. $softBank = total ($creditSum,0,$softPer,$mounthPay, $softCom);
  40.  
  41. $strwPer = 1.02;
  42. $payStartStwr = 7777;
  43.  
  44. $strwBank = total ($creditSum,$payStartStwr,$strwPer,$mounthPay,0);
  45.  
  46. echo "homoCredit обошелся в {$homoCredit} руб \n";
  47. echo "softBank обошелся в {$softBank} руб \n";
  48. echo "strwBank обошелся в {$strwBank} руб \n";
  49.  
  50. ?>
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
homoCredit обошелся в 42098.96 руб 
softBank обошелся в 42198.97 руб 
strwBank обошелся в 48731.52 руб