fork download
  1.  
  2. <?php
  3.  
  4. $creditSum = 39999;
  5. $payout = 5000;
  6. $totalPaymentHomo = 0;
  7. $totalPaymentSoft = 0;
  8. $totalPaymentStrawberry =0;
  9.  
  10. class Bank
  11. {
  12. public $percent;
  13. public $credit;
  14. public $servicePay;
  15. }
  16.  
  17. $homoBank = new Bank;
  18. $homoBank->percent = 0.04;
  19. $homoBank->credit = $creditSum;
  20. $homoBank->servicePay = 500;
  21.  
  22. for ($i = 1; $i < 15; $i++){
  23. $homoBank->credit = $homoBank->credit + ($homoBank->credit * $homoBank->percent);
  24. $homoBankPayment = $homoBank->credit - ($payout - $homoBank->servicePay);
  25. $homoBank->credit = $homoBankPayment;
  26. $totalPaymentHomo = $totalPaymentHomo + $payout;
  27. echo $homoBank->credit . "<br>" . $totalPaymentHomo . "</br>";
  28.  
  29. if ($homoBank->credit < 0){
  30. echo "<b>Кредит выплачен за $i месяцев, всего ушло на погашение $totalPaymentHomo</b><br>";
  31. break;
  32. }
  33.  
  34.  
  35. }
  36.  
  37. $Softbank = new Bank;
  38. $Softbank->percent = 0.03;
  39. $Softbank->credit = $creditSum;
  40. $Softbank->servicePay = 1000;
  41.  
  42. for ($i = 1; $i < 15; $i++){
  43. $Softbank->credit = $Softbank->credit + ($Softbank->credit * $Softbank->percent);
  44. $SoftbankPayment = $Softbank->credit - ($payout - $Softbank->servicePay);
  45. $Softbank->credit = $SoftbankPayment;
  46. $totalPaymentSoft = $totalPaymentSoft + $payout;
  47. echo $Softbank->credit . "<br>" . $totalPaymentSoft . "</br>";
  48.  
  49. if ($Softbank->credit < 0){
  50. echo "<b>Кредит выплачен за $i месяцев, всего уйдет на погашение $totalPaymentSoft</b><br>";
  51. break;
  52. }
  53.  
  54. }
  55.  
  56. $StrawberryBank = new Bank;
  57. $StrawberryBank->percent = 0;
  58. $StrawberryBank->credit = $creditSum + 7777;
  59. $StrawberryBank->servicePay = 0;
  60.  
  61. for ($i = 1; $i < 15; $i++){
  62. $StrawberryBank->credit = $StrawberryBank->credit + ($StrawberryBank->credit * $StrawberryBank->percent);
  63. $StrawberryBankPayment = $StrawberryBank->credit - ($payout - $StrawberryBank->servicePay);
  64. $StrawberryBank->credit = $StrawberryBankPayment;
  65. $totalPaymentStrawberry = $totalPaymentStrawberry + $payout;
  66. echo $StrawberryBank->credit . "<br>" . $totalPaymentStrawberry . "</br>";
  67. if ($StrawberryBank->credit < 0){
  68. echo "<b>Кредит выплачен за $i месяцев, всего ушло на погашение $totalPaymentStrawberry</b><br>";
  69. break;
  70. }
  71.  
  72. }
  73.  
  74.  
  75. ?>
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
37098.96<br>5000</br>34082.9184<br>10000</br>30946.235136<br>15000</br>27684.08454144<br>20000</br>24291.447923098<br>25000</br>20763.105840022<br>30000</br>17093.630073622<br>35000</br>13277.375276567<br>40000</br>9308.47028763<br>45000</br>5180.8090991352<br>50000</br>888.04146310056<br>55000</br>-3576.4368783754<br>60000</br><b>Кредит выплачен за 12 месяцев, всего ушло на погашение 60000</b><br>37198.97<br>5000</br>34314.9391<br>10000</br>31344.387273<br>15000</br>28284.71889119<br>20000</br>25133.260457926<br>25000</br>21887.258271663<br>30000</br>18543.876019813<br>35000</br>15100.192300408<br>40000</br>11553.19806942<br>45000</br>7899.7940115026<br>50000</br>4136.7878318477<br>55000</br>260.89146680312<br>60000</br>-3731.2817891928<br>65000</br><b>Кредит выплачен за 13 месяцев, всего уйдет на погашение 65000</b><br>42776<br>5000</br>37776<br>10000</br>32776<br>15000</br>27776<br>20000</br>22776<br>25000</br>17776<br>30000</br>12776<br>35000</br>7776<br>40000</br>2776<br>45000</br>-2224<br>50000</br><b>Кредит выплачен за 10 месяцев, всего ушло на погашение 50000</b><br>