5 * 5 matrix with column multiplied by row in php


OutPut:

1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25

Code:
<?php
// Your code here!
for($i=1;$i<=5;$i++){
    echo $i;// $i as row 
   for($j=1;$j<5;$j++){ // $j as column
        echo  " ";
        echo ($j+1)*$i;    
     }
    echo "\n";
}
?>
About

myself pramodh kumar yet another php developer from India and have worked on oops,procedural,yii framework,codeigniter,wordpress,joomla,api and more.

Tagged with: , ,
Posted in matrix php, php, php interview question

Leave a comment

Follow Tutorial on WordPress.com
categories
Calendar
June 2019
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
Follow me on Twitter
Blog Stats
  • 88,191 hits