6. (B) Write a PHP program to display the following Binary Pyramid: 1 0 1 1 0 1 0 1 0 1

6. (B) Write a PHP program to display the following Binary Pyramid:
                 1
                 0   1
                 1   0   1 
                 0   1   0   1

<?php
for($i=0;$i<4;$i++)
{
for($j=0;$j<=$i;$j++)
{
if(($i+$j)%2==0)
echo"1";
else
echo"0";
}
echo"<br>";
}
?>
6. (B) Write a PHP program to display the following Binary Pyramid: 1 0 1 1 0 1 0 1 0 1 6. (B) Write a PHP program to display the following Binary Pyramid: 1 0 1 1 0 1 0 1 0 1 Reviewed by admin on December 24, 2019 Rating: 5

No comments:

Powered by Blogger.