fork download
  1. <?php
  2.  
  3.  
  4. function homoCredit($creditSum, $percent, $commission, $payout)
  5. {
  6. $totalPayout = 0;
  7. for ($month = 1; $creditSum > 0; $month++)
  8. {
  9. $creditSum = ($creditSum * $percent) + $commission - $payout;
  10. if ($creditSum < 5000)
  11. {
  12. $totalPayout += $creditSum;
  13. $creditSum = 0;
  14. }
  15. else
  16. {
  17. $totalPayout += 5000;
  18. }
  19. }
  20. return $totalPayout;
  21. }
  22.  
  23. function softbank($creditSum, $percent, $commission, $payout)
  24. {
  25. $totalPayout = 0;
  26. for ($month = 1; $creditSum > 0; $month++)
  27. {
  28. $creditSum = ($creditSum * $percent) + $commission - $payout;
  29. if ($creditSum < 5000)
  30. {
  31. $totalPayout += $creditSum;
  32. $creditSum = 0;
  33. }
  34. else
  35. {
  36. $totalPayout += 5000;
  37. }
  38. }
  39. return $totalPayout;
  40. }
  41.  
  42. function strawberryBank($creditSum, $percent, $openCommission ,$payout)
  43. {
  44. $totalPayout = 0;
  45. $creditSum += $openCommission;
  46. for ($month = 1; $creditSum > 0; $month++)
  47. {
  48. $creditSum = ($creditSum * $percent) - $payout;
  49. if ($creditSum < 5000)
  50. {
  51. $totalPayout += $creditSum;
  52. $creditSum = 0;
  53. }
  54. else
  55. {
  56. $totalPayout += 5000;
  57. }
  58. }
  59. return $totalPayout;
  60. }
  61.  
  62. $creditSum = 39999;
  63. $payout = 5000;
  64. $homoCreditTotal = homoCredit($creditSum, 1.04, 500, $payout);
  65. $softbankTotal = softbank($creditSum, 1.03, 1000, $payout);
  66. $strawberryBankTotal = strawberryBank($creditSum, 1.02, 7777, $payout);
  67.  
  68. echo "homoCredit: {$homoCreditTotal} руб. \n";
  69. echo "softbank: {$softbankTotal} руб. \n";
  70. echo "strawberryBank: {$strawberryBankTotal} руб. \n";
Success #stdin #stdout 0.01s 82560KB
stdin
Standard input is empty
stdout
homoCredit: 50888.041463101 руб. 
softbank: 54136.787831848 руб. 
strawberryBank: 48490.07241098 руб.