gundambison

jawaban yg benar

Jul 11th, 2014
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.25 KB | None | 0 0
  1. <?php
  2.  
  3. $p=3;$s='';
  4. for($i1=0;$i1<$p;$i1++)
  5. {
  6.   for($i2=0;$i2<$p;$i2++){
  7.       for($i3=0;$i3<$p;$i3++){
  8.         if(($i3==$i1)&&($i2%2==0)||($i3==$p-$i1-1)&&($i2%2==1) )
  9.         {
  10.           $s.="*";
  11.         }else{
  12.           $s.="-";
  13.         }
  14.       }
  15.  
  16.   }
  17.  
  18. $s.="</br>";
  19. }
  20. echo $s;
Advertisement
Add Comment
Please, Sign In to add comment