-
Notifications
You must be signed in to change notification settings - Fork 0
/
Solution.php
34 lines (31 loc) · 886 Bytes
/
Solution.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
30
31
32
33
34
<?php
/**
* Print Number, Linio, IT or Linianos
*
* @author Kamal Kant <[email protected]>
*/
class Solution
{
public function __construct()
{
//15 Values for satisfying given condition
$this->StringOptions = ['', '', 'Linio', '', 'IT', 'Linio', '', '', 'Linio', 'IT', '', 'Linio', '', '', 'Linianos'];
}
public function printNumberString()
{
for ($i = 1; $i <= 100; $i++) {
$strValue = $this->printString($i);
if (!empty($strValue)) {
echo $strValue . PHP_EOL;
continue;
}
echo $i . PHP_EOL;
}
}
public function printString(int $n)
{
return $this->StringOptions[($n - 1) % 15] ? $this->StringOptions[($n - 1) % 15] : $n;
}
}
$class = new Solution();
$class->printNumberString();