Pattern Printing 2

3/21/2012 code-examplephppattern-printing

# Summary

The following pattern is coded in php, as it was asked by one of my friend.

Prints the multiples in the following way.

0
0 2
0 3 6
0 4 8 12
0 5 10 15 20
0 6 12 18 24 30
0 7 14 21 28 35 42
1
2
3
4
5
6
7

# Screenshot

Pattern #2 PHP Output

# Code

<?php
for($i = 1; $i <= 7; $i++)
{
	for($j = 0; $j < $i; $j++)
	{
		echo $i * $j. ' ';
	}
	// Print New Line using br tag
	echo '<br>';
}
?>
1
2
3
4
5
6
7
8
9
10
11