Write a program print 1 to 100 number. When number is multiple of 3 then print "Ela", multiple of 5 then print "Bella", multiple of both 3 and 5 print "ElaBella".
<?php
for($i=1; $i<=100; $i++)
{
if($i%3 == 0 && $i%5 == 0)
{
echo "ElaBella <br>";
}
else
{
if($i%3 == 0)
{
echo "Ela <br>";
}
elseif($i%5 == 0)
{
echo "Bella <br>";
}
else
{
echo $i . "<br>";
}
}
}
?>
Any other program in PHP like 'print star pattern', 'print number pattern'
Labels: PHP