Skip to content

PHP For (Dasi Kupu-Kupu 1/2)

March 14, 2011
<?php
 for ($a=1;$a<=5;$a++)
 {
 for ($b=5;$b>=$a;$b--)

{

echo "$b" ;

}

for ($c=1;$c<=$a;$c++)

{
 echo "&nbsp;&nbsp;&nbsp;&nbsp;" ;

}

for ($e+=1,$d=$e;$d<=5;$d++)

{

echo "$d" ;

}

echo "<br>" ;

}

?>

Hasilnya :

54321    12345
5432         2345
543              345
54                   45
5                        5

From → Pemrograman, PHP

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: