fork(1) download
  1. <?php
  2. //Баланс 39999, месячная плата 5000, гомо% 4, гомоком 500, софт%3, софтком 1000, страв%2, стравоткрытие 7777
  3. function ipad($hBalance,$sBalance,$stBalance,$monthPayment,$homoPercent,$homoService,$softPercent,$softService, $strawPercent,$strawOpen) {
  4. for ($i = 1; $i = 100; $i++) {
  5. $hBalance = $hBalance * $homoPercent + $homoService;
  6. if ($hBalance < $monthPayment) {
  7. $totalHomoPayment = $totalHomoPayment + $hBalance;
  8. break;
  9. }
  10. else
  11. {
  12. $hBalance = $hBalance - $monthPayment;
  13. $totalHomoPayment = $totalHomoPayment + $monthPayment;
  14. }
  15. }
  16. for ($i = 1; $i = 100; $i++) {
  17. $sBalance = $sBalance * $softPercent + $softService;
  18. if ($sBalance < $monthPayment) {
  19. $totalSoftPayment = $totalSoftPayment + $sBalance;
  20. break;
  21. }
  22. else
  23. {
  24. $sBalance = $sBalance - $monthPayment;
  25. $totalSoftPayment = $totalSoftPayment + $monthPayment;
  26. }
  27. }
  28. $stBalance = $stBalance + $strawOpen;
  29. for ($i = 1; $i = 100; $i++) {
  30. $stBalance = $stBalance * $strawPercent;
  31. if ($stBalance < $monthPayment) {
  32. $totalStrawPayment = $totalStrawPayment + $stBalance;
  33. break;
  34. }
  35. else
  36. $stBalance = $stBalance - $monthPayment;
  37. $totalStrawPayment = $totalStrawPayment + $monthPayment;
  38. }
  39. return $totalHomoPayment.=$totalSoftPayment.$totalStrawPayment;
  40. }
  41.  
  42.  
  43. $homoTotal = ipad(39999,0,0,5000,1.04,500,0,0,0,0);
  44. $softTotal = ipad(0,39999,0,5000,0,0,1.03,1000,0,0);
  45. $strawTotal = ipad(0,0,39999,5000,0,0,0,0,1.02,7777);
  46. echo "Гомобанк $homoTotal\n";
  47. echo "Софтбанк $softTotal\n";
  48. echo "Стравберри $strawTotal\n";
Success #stdin #stdout #stderr 0.01s 52488KB
stdin
Standard input is empty
stdout
Гомобанк 56423.56312162500
Софтбанк 061268.7182108070
Стравберри 0053559.8738592
stderr
PHP Notice:  Undefined variable: totalHomoPayment in /home/wurFUE/prog.php on line 14
PHP Notice:  Undefined variable: totalSoftPayment in /home/wurFUE/prog.php on line 20
PHP Notice:  Undefined variable: totalStrawPayment in /home/wurFUE/prog.php on line 33
PHP Notice:  Undefined variable: totalHomoPayment in /home/wurFUE/prog.php on line 8
PHP Notice:  Undefined variable: totalSoftPayment in /home/wurFUE/prog.php on line 26
PHP Notice:  Undefined variable: totalStrawPayment in /home/wurFUE/prog.php on line 33
PHP Notice:  Undefined variable: totalHomoPayment in /home/wurFUE/prog.php on line 8
PHP Notice:  Undefined variable: totalSoftPayment in /home/wurFUE/prog.php on line 20
PHP Notice:  Undefined variable: totalStrawPayment in /home/wurFUE/prog.php on line 38