how do i do a table pyramid?
e.g.
1st column(1 row), 2nd column(2rows), 3rd column(3rows)
<?php
$rows=5;
print "<table border=0>";
for($i=0;$i<$rows;$i++)
{
print "<tr>";
for ($j=0;$j<=$i;$j++)
{
print "<td >".$i*$j."</td>" ;
}
print "<tr>";
}
?>
The above code shows the right angle traingle
Pyramid:
<?php
$rows=10;
for ($i = 1; $i <= $rows; $i++) {
for ($j = $i; $j <= $rows - i; $j++){
echo " ";
}
for ($k = 1; $k <= $i; $k++) {
echo $k . " ";
}
echo "<br/>";
}
?>
The above code have some limitations too.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.