-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp10.php
More file actions
27 lines (24 loc) · 760 Bytes
/
php10.php
File metadata and controls
27 lines (24 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<h3>Hitung Luas Setengah Lingkaran</h3>
<p>Masukkan Jari-Jari Lingkaran</p>
<form action="php10.php" method="post">
Diameter :<input type="text" name="diameter"><br>
<input type="submit" name="submit" value="Hitung">
</form>
<?php
if(isset($_POST['submit'])){
$diameter = $_POST['diameter'];
$jari3 = 1/2 * $diameter;
$phi = 22/7;
$luas_lingkaran = $phi * ($jari3 * $jari3);
$hasil = 1/2 * $luas_lingkaran;
echo "Luas lingkaranan setengah lingkaran yang berdiameter $diameter cm adalah $hasil <br/>";
}
echo "<hr>";
echo "<h3>Luas setengah lingkaran Tanpa Input</h3>";
function luas($p,$d){
$j2=$d/2;
$h=($p*$j2*$j2)/2;
return$h;
}
echo "Luasnya setengah lingkaran yang berdiameter $diameter cm adalah ".luas(3.14, 10);
?>