-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1803.php
More file actions
38 lines (30 loc) · 757 Bytes
/
1803.php
File metadata and controls
38 lines (30 loc) · 757 Bytes
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
30
31
32
33
34
35
36
37
38
<?php
function hoopCount(int $n): string
{
return $n >= 10 ? "Great, now move on to tricks" : "Keep at it until you get it";
}
echo hoopCount(10);
function rangeAry(int $a, int $b)
{
return $a < $b ? range($a, $b) : 'Not a valid input';
}
print_r(rangeAry(12, 16));
// nb_year(1500, 5, 100, 5000) -> 15
function nb_year($p0, $percent, $aug, $p)
{
$total = $p0;
$year = 0;
do {
$total = countTotal(round($total), $percent, $aug);
$year++;
// echo $year, "<br>";
} while ($total < $p);
return $year;
}
function countTotal($p0, $percent, $aug)
{
// echo $p0, $percent, $aug;
$newPer = ($p0 * ($percent / 100));
return ($p0 + $newPer + $aug);
}
echo nb_year(1500000, 2.5, 10000, 2000000);