Skip to content

Instantly share code, notes, and snippets.

@Shipu
Created January 1, 2018 21:28
Show Gist options
  • Save Shipu/3bef357e0b9b08103110a4ba63c414c4 to your computer and use it in GitHub Desktop.
Save Shipu/3bef357e0b9b08103110a4ba63c414c4 to your computer and use it in GitHub Desktop.
<?php
$caseNo = 0;
foreach (range(1, 9) as $numberOne) {
$makeNumberOne = ($numberOne * 100) + 62;
foreach (range(1, 9) as $numberTwo) {
$makeNumberTwo = ($numberTwo * 10) + 7;
$result = $makeNumberOne * $makeNumberTwo;
if (($result % 10 == 4) && ((int) ($result / 10000) == 5) && ((int) (($numberTwo * $makeNumberOne) / 1000) == 5)) {
echo '<h4>Case No: ' . ++$caseNo . "</h4>";
echo str_repeat('&nbsp;', 12);
echo $makeNumberOne;
echo '<br>x';
echo str_repeat('&nbsp;', 12);
echo $makeNumberTwo;
echo '<br>';
echo '-------------------';
echo '<br>';
echo str_repeat('&nbsp;', 10);
echo($makeNumberOne * 7);
echo '<br>';
echo str_repeat('&nbsp;', 8);
echo($numberTwo * $makeNumberOne);
echo '+<br>';
echo '-------------------';
echo '<br>';
echo str_repeat('&nbsp;', 8);
echo $result;
echo str_repeat('<br>', 2);
}
}
}
@Shipu
Copy link
Author

Shipu commented Jan 1, 2018

Problem Set
Result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment