Last active
September 9, 2021 08:54
-
-
Save adityadees/bb805e9b11149b78acc9aee8cdb69cf5 to your computer and use it in GitHub Desktop.
BUS SEAT PATTERN 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
$divide = 4; | |
$inside = 2; | |
echo "<table border='1'>"; | |
for($i = 1; $i <= 45; $i++){ | |
if($i % $divide == 1 && $i != 45){ | |
echo "<tr>"; | |
} | |
echo "<td width='15%' align='center'>".$i."</td>"; | |
if($i % $inside == 0 && $i % $divide != 0 && $i != 42){ | |
echo "<td width='40%'> </td>"; | |
} | |
if($i % $divide == 0 && $i != 44){ | |
echo "</tr>"; | |
} | |
} | |
echo "</table>"; |
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
$divide = 4; | |
$inside = 2; | |
echo "<table border='1'>"; | |
for($i = 1; $i <= 40; $i++){ | |
if($i % $divide == 1){ | |
echo "<tr>"; | |
} | |
echo "<td width='15%' align='center'>".$i."</td>"; | |
if($i % $inside == 0 && $i % $divide != 0){ | |
echo "<td width='40%'> </td>"; | |
} | |
if($i % $divide == 0){ | |
echo "</tr>"; | |
} | |
} | |
echo "<tr>"; | |
for ($i = 41; $i <= 45; $i++) { | |
echo "<td width='15%' align='center'>".$i."</td>"; | |
} | |
echo "</tr>"; | |
echo "</table>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment