<html>
<head><title>Menentukan Suhu
Drajat</title></head>
<body>
<form method="POST">
Masukan Suhu:
<input type="text" size="4"
name="ctemp"><sup>o</sup>C<br>
<input type="submit" name="proses"
value="Hitung">
<br><br>
<?php
$ctemp=$_POST['ctemp'];
if (isset($proses))
{
echo "Suhu
sekarang : ".$ctemp."<sup>o</sup>C<br>";
echo
"Fahrenheit : ";
echo
32+$ctemp/5*9;
echo
"<sup>o</sup>C<br>";
echo "Kelvin
: ";
echo $ctemp+273.1;
echo
"<sup>o</sup>K<br>";
echo "Wujud
air : ";
switch($ctemp)
{
case
($ctemp<0) : {echo "<font
color='red'><b>membeku</b></font>";
$aktifitas="bermain ski";break;}
case
($ctemp>100) : {echo "<font
color='red'><b>beruap</b></font>";
$aktifitas="sauna
bathing";break;}
default :
{echo "<font
color='red'><b>mencair</b></font>";
$aktifitas="berenang";break;}
}
echo
"<br> Aktivitas yg cocok dilakukan : ".$aktifitas;
}
?>
</form>
</body>
</html
OUTPUT
Tidak ada komentar:
Posting Komentar