fork download
  1. <?php
  2. function credit($credit_sum, $percent, $commision, $payout, $addition_pay) {
  3. $total=0;
  4. $sum=$credit_sum+$addition_pay;
  5. for ($sum;$sum>0;$sum) {
  6. if ($sum>=$payout) {
  7. $sum=$sum*$percent-$payout;
  8. $total=$total+$commision+$payout;
  9. }
  10. else {
  11. $total=$total+$commision+$sum;
  12. $sum=0;
  13. }
  14. }
  15. return $total;
  16. }
  17. $homo_credit_total=credit(4000, 1.04, 500, 5000, 0);
  18. $soft_bank_total=credit(4000, 1.03, 1000, 5000, 0);
  19. $strawberry_bank_total=credit(4000, 1.02, 0, 5000, 7777);
  20.  
  21. echo "HomoBank total amount: {$homo_credit_total}\n";
  22. echo "SoftCredit total amount: {$soft_bank_total}\n";
  23. echo "StrawbberyBank total amount: {$strawberry_bank_total}\n";
  24. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
HomoBank total amount: 4500
SoftCredit total amount: 5000
StrawbberyBank total amount: 12152.7908