Sunday 11 August 2013

Multiplication table using php

In this post i haved designed how  to create a multiplication table that is generated by a loop that is 12 columns across.By using for loop concept lets see how the multiplication table is going to be design.
          Here i haved used nested loop ie used the for loop inside a for loop to display the output.


Multiplication table using php




Index :

<center>
<h1>Multiplication table</h1>

<table border="0" cellpadding="8" cellspacing="0" class="tbl">

     <?php
     
         for($i=1;$i<=12;$i++)
         {
             echo("<tr>");
             for($j=1;$j<=12;$j++)
             {
                 echo "<td align=right>",$i*$j;
             }
             
         }
     
     ?>        

</table>

</center>
<style type="text/css">
.tbl
{
    border:dotted  #800040;
    color:#000066;
}
h1{color:#660033;}
</style>

No comments:

Post a Comment