forked from wafarifki/Hacktoberfest_2021
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlingkaran.php
More file actions
31 lines (27 loc) · 827 Bytes
/
Copy pathlingkaran.php
File metadata and controls
31 lines (27 loc) · 827 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
28
29
30
31
<?php
// membuat rumus hitung luas dan keliling lingkaran
function formula($r, $si)
{
//variabel string dan integer
$soal = 1 . ". Jika diketahui jari jari sebuah lingkaran adalah "
. $r . $si .
", maka berapakah luas dan keliling lingkaran tersebut? <br>";
//buat constanta
define("phi", 3.14);
//tampilkan soal
echo $soal;
print "<hr>";
echo "Phi : " . phi . "<br>" . "Jari-jari : " . $r . $si . "<br>";
print "-------------------------- <br>";
echo "<b>Luas</b> : " . phi * $r * $r . $si . "<sup>2</sup><br>";
echo "<b>Keliling</b> : " . phi * (2 * $r) . $si;
}
// jalankan rumus
$run = formula(10, "cm");
echo $run;
echo "<div style='position:fixed;bottom:5px;font-size:10px'>
<p>
Made with ❤️ by Sahl
</p>
</div>";
?>