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