Source Code



Looping Leaning Figures

  • anonymous
  • Aug 18' 13
  • PHP
  • 524
  • 22
  • United States

Berikut ini adalah listing kode untuk membuat looping nilai menurun dan mencetak blok panah dalam segi empat :

<?php

$awal=1;
$akhir=9;
$manggaindramayu=$awal;
$sukalila=$akhir;
for  ( $y=$awal; $y <=$akhir; $y++ ){
	for  ( $x=$awal; $x <=$sukalila; $x++ ){echo'[]';}
	for  ( $z=$awal; $z <=$manggaindramayu; $z++ ){echo'[]';}
	for  ( $z=$awal+1; $z <=$manggaindramayu; $z++ ){echo'[]';}
	for  ( $x=$awal; $x <=$sukalila; $x++ ){echo'[]';}
	echo "
";$sukalila-=1;$manggaindramayu+=1; } $awal=4; $akhir=9; for ( $y=$awal; $y <=$akhir; $y++ ){ for ( $x=$y; $x<=$akhir; $x++ ){ echo $x; } echo "
"; } $awal=4; $akhir=9; $manggaindramayu=$awal; $sukalila=$akhir; for ( $y=$awal; $y <=$akhir; $y++ ){ for ( $z=$awal+1; $z <=$manggaindramayu; $z++ ){echo'   ';} for ( $x=$awal; $x <=$sukalila; $x++ ){echo' '.$x.'';} echo "
";$sukalila-=1;$manggaindramayu+=1; } ?>

dan hasilnya adalah

[][][][][][][][][][][][][][][][][][][]
[][][][][][][][][][][][][][][][][][][]
[][][][][][][][][][][][][][][][][][][]
[][][][][][][][][][][][][][][][][][][]
[][][][][][][][][][][][][][][][][][][]
[][][][][][][][][][][][][][][][][][][]
[][][][][][][][][][][][][][][][][][][]
[][][][][][][][][][][][][][][][][][][]
[][][][][][][][][][][][][][][][][][][]

456789
56789
6789
789
89
9


 4 5 6 7 8 9
    4 5 6 7 8
       4 5 6 7
          4 5 6
             4 5
                4
  • Tags :
comments powered by Disqus

Related Code

Remarks Script Browser

Creating Specification Page Number

Enter removing Signs In Field (string)

Deleting Log MSSQL Database

Restore and Backup Database MSSQL Using Query

SQL Database backup using Query

Piramida bintang rata kanan

Program design Pot

Program piramida bintang rata kiri bawah

Piramida bintang rata kanan bawah



Category