<?php
function totalPay( $monthPay , $tax , $creditSum , $bankPercent , $bankName , $oneTimeTax ) {
for ( $month = 1 ; $month <= 20 ; $month ++ ) {
$creditSum = ( $creditSum * $bankPercent ) + $tax - $monthPay ;
$total = $total + $monthPay ;
if ( $creditSum < 0 ) {
$monthPay = $creditSum ;
$total = $total + $monthPay + $oneTimeTax ;
$creditSum = $creditSum - $monthPay ;
$month = $month + 1 ;
echo "Анон платит {$month} месяцев. Заплатит {$total} банку {$bankName} .\n " ;
break ;
}
}
echo "\n \n " ;
}
$homoCredit = totalPay( 5000 , 500 , 39999 , 1.04 , 'HOMOCREDIT' , 0 ) ;
$softBank = totalPay( 5000 , 1000 , 39999 , 1.03 , 'SOFTBANK' , 0 ) ;
$strawberryBank = totalPay( 5000 , 0 , 39999 , 1.02 , 'STRAWBERRYBANK' , 7777 ) ;
echo "{$homoCredit} \n " ;
echo "{$softBank} \n " ;
echo "{$strawberryBank} \n " ;
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKCmZ1bmN0aW9uIHRvdGFsUGF5KCRtb250aFBheSwgJHRheCwgJGNyZWRpdFN1bSwgJGJhbmtQZXJjZW50LCAkYmFua05hbWUsICRvbmVUaW1lVGF4KSB7Cglmb3IgKCRtb250aCA9IDE7ICRtb250aCA8PSAyMDsgJG1vbnRoKyspIHsKCQkkY3JlZGl0U3VtID0gKCRjcmVkaXRTdW0gKiAkYmFua1BlcmNlbnQpICsgJHRheCAtICRtb250aFBheTsKCQkKCQkKCQkKCQkkdG90YWwgPSAkdG90YWwgKyAkbW9udGhQYXk7CgkKCQkJCgoJCWlmICgkY3JlZGl0U3VtIDwgMCkgewoJCQkkbW9udGhQYXkgPSAkY3JlZGl0U3VtOwoJCQkkdG90YWwgPSAkdG90YWwgKyAkbW9udGhQYXkgKyAkb25lVGltZVRheDsKCQkJJGNyZWRpdFN1bSA9ICRjcmVkaXRTdW0gLSAkbW9udGhQYXk7CgkJCSRtb250aCA9ICRtb250aCArIDE7CgkJCW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