@underbottom/

value credit

PHP (Legacy)

No description

fork
loading
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
 
error_reporting(-1);

function countPercent($amountDebt,$percent,$commission,$bankName) {
  $result [0] = 0;
  $payment = 5000;
  for ($i=1;0<$amountDebt;$i++) {
    $amountDebt=$amountDebt*$percent+$commission;
    $result[0] += min ($amountDebt, $payment);
    $amountDebt -= $payment; 
  }

  $result [1] = $i;
  $result [2] = $bankName;

  return $result;
}
 

$homo = countPercent(40000,1.04,500,"Homocredit");
$soft = countPercent(40000,1.03,1000,"Softbank");
$bank = countPercent(47777,1.02,0,"StrawberryBank");

$totalResult = min ($homo,$soft,$bank);

echo "Самый выгодный банк: {$totalResult[2]}\nРеальная цена айпада: {$totalResult[0]}\nВремя выплаты: {$totalResult[1]} месяцев.\n";

?>
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7