Created
August 16, 2019 12:33
-
-
Save tolawho/cf805d0054cf3c1e95f4590ee9bf37dd to your computer and use it in GitHub Desktop.
expendnumber.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ten = 10; | |
$max = 15; | |
$current = 0; | |
$step = 0; | |
for ($i = 1; $i <= $max; $i++) { | |
$b = $c = $i; | |
$d = $current * 10; | |
$count1 = $count2 = 0; | |
while ($b % 10 == 0): | |
$count1++; | |
$b /= 10; | |
endwhile; | |
while ($c / 10 > 1 ): | |
$count2++; | |
$c /= 10; | |
endwhile; | |
$diff = abs($count1 - $count2); | |
for ($k = 1; $k <= $diff; $k++) { | |
$d *=10; | |
} | |
$current = $i + $d; | |
} | |
echo $current; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment