fork(2) download
  1. <?php
  2. function kappa($creditSum, $payout, $percent, $payment, $payment1){
  3. $creditSum = $creditSum + $payment1;
  4. $paymentTotal = 0;
  5. for($i = 0; $i <666; $i++){
  6. $creditSum = $creditSum * $percent + $payment - $payout;
  7. $paymentTotal = $paymentTotal + $payout;
  8. if($creditSum < 0){
  9. $paymentTotal = $paymentTotal + $creditSum;
  10. break;
  11. }
  12. }
  13. return $paymentTotal;
  14. }
  15. $creditSum = 39999;
  16. $payout = 5000;
  17. $homoCreditTotal = kappa($creditSum, $payout, 1.04, 500, 0);
  18. $softbankTotal = kappa($creditSum, $payout, 1.03, 1000, 0);
  19. $strawberryBankTotal = kappa($creditSum, $payout, 1.02, 0, 7777);
  20. echo "Homocredit: {$homoCreditTotal} руб.\n";
  21. echo "Softbank: {$softbankTotal} руб.\n";
  22. echo "StrawberryBank: {$strawberryBankTotal} руб.\n";
  23.  
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
0
1
2
3
4
5
6
7
8
9
10
11
0
1
2
3
4
5
6
7
8
9
10
11
12
0
1
2
3
4
5
6
7
8
9
10
Homocredit: 56423.563121625 руб.
Softbank: 61268.718210807 руб.
StrawberryBank: 53559.8738592 руб.