mardi 12 février 2019

How Can I Create Pattern Like this:

I am trying to make a pyramid program in PHP like this:

1  2  3  4
8  7  6  5
9 10 11 12

I am trying this for the last 4 hours but couldn't make that. Can anyone please help me in doing that.

Thanks in advance...

I tried this :

$num = 0;
for ($i=0; $i<=2; $i++)  
{  
for ($j=1; $j<=5; $j++)  
{  
     $num = $j - $i+$num;
     echo $num.""; 
     $num--;
}  
       echo "</br>";  
 }  

I am trying to make a pyramid program in PHP like this:

1  2  3  4
8  7  6  5
9 10 11 12

Aucun commentaire:

Enregistrer un commentaire