UTS-1.php
[php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>UTS 1</title>
</head>
<body>
Masukan batas perulangan<br />
<form action="UTS-2.php" method="post">
<input type=text name='bil'/>
<input type = submit value="Jalankan"/>
</form>
</body>
</html>
[/php]
[php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?
echo "Hasil Perulangan<br>";
$bil=$_POST['bil'];
$a=1;
$b=1;
echo $a."";
echo "1 ";
for ($urut= 1;$urut<=$bil;$urut++)
{
$a=$a+$b;
$b=Sa-$b+$a;
if ($a %2==1)
{
echo("<font color=red>$a</font>"." ");
}
else
if ($a %2==0)
{
echo("<font color=blue>$a</font>"." ");
}
}
?>
<br>
<a href="UTS-1.php">Kembali</a>
</body>
</html>
[/php]
Home
Bahasa Pemrograman
Bilangan Fibonachi Dengan PHP
Bilangan Fibonachi Dengan PHP
Minggu, 05 Mei 2013
Label:
Bahasa Pemrograman
0 komentar:
Speak up your mind
Tell us what you're thinking... !