CodesJava

Easy learning with example program codes

PHP program to print table of a number

PHP program to print table of a number:

The below program prints table of a number using a loop. The PHP echo statement is used to output the result on the screen.
Example

<!DOCTYPE html>
<html>
<body>
 
<?php    
$num = 9;  
for($i=1; $i<=10; $i++)   
{
$product = $i*$num;
echo "$num * $i = $product" ;   
echo '<br>';	 
}  
?> 
 
</body>
</html>

Output

9 * 1 = 9
9 * 2 = 18
9 * 3 = 27
9 * 4 = 36
9 * 5 = 45
9 * 6 = 54
9 * 7 = 63
9 * 8 = 72
9 * 9 = 81
9 * 10 = 90
Please follow and like us:
error
Posted in PHP   








Copyright © 2019 CodesJava DMCA.com Protection Status