<?php
function getBalanceInFuture( $credit , $percent , $comission , $payment , $payout , $month ) {
for ( $i = 1 ; $i <= $month ; $i ++ ) {
if ( $payment == 7777 ) {
$credit = $credit + $credit * $percent + $comission + $payment - $payout ;
$payment ++; }
else {
$credit = $credit + $credit * $percent + $comission - $payout ;
}
}
return $credit ;
}
$homoTotal = getBalanceInFuture( 39999 , 0.04 , 500 , 0 , 5000 , 11 ) ;
$softTotal = getBalanceInFuture( 39999 , 0.03 , 1000 , 0 , 5000 , 11 ) ;
$strawberryTotal = getBalanceInFuture( 39999 , 0.02 , 0 , 7777 , 5000 , 11 ) ;
echo "За 11 месяцев школьник будет должен банку {$homoTotal} руб.\n " ;
echo "За 11 месяцев школьник будет должен банку {$softTotal} руб.\n " ;
echo "За 11 месяцев школьник будет должен банку {$strawberryTotal} руб.\n " ;
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKCmZ1bmN0aW9uIGdldEJhbGFuY2VJbkZ1dHVyZSgkY3JlZGl0LCRwZXJjZW50LCRjb21pc3Npb24sJHBheW1lbnQsJHBheW91dCwkbW9udGgpIHsKCWZvciAoJGk9MTskaTw9JG1vbnRoOyRpKyspIHsKICAgIGlmICgkcGF5bWVudD09Nzc3NykgewogICAgJGNyZWRpdCA9ICRjcmVkaXQgKyAkY3JlZGl0ICogJHBlcmNlbnQgKyAkY29taXNzaW9uICsgJHBheW1lbnQgLSAkcGF5b3V0OwogICAgJHBheW1lbnQrKzt9CiAgICBlbHNlIHsgCiAgICAkY3JlZGl0ID0gJGNyZWRpdCArICRjcmVkaXQgKiAkcGVyY2VudCArICRjb21pc3Npb24gLSAkcGF5b3V0OwogICAgfQoJfQoJcmV0dXJuICRjcmVkaXQ7Cn0KJGhvbW9Ub3RhbD0gZ2V0QmFsYW5jZUluRnV0dXJlKDM5OTk5LDAuMDQsNTAwLDAsNTAwMCwxMSk7CiRzb2Z0VG90YWw9IGdldEJhbGFuY2VJbkZ1dHVyZSgzOTk5OSwwLjAzLDEwMDAs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