]> git repositories - circle.git/commitdiff
first commit
authorbochard <mail@tenkyuu.dev>
Mon, 14 Apr 2025 11:42:39 +0000 (19:42 +0800)
committerbochard <mail@tenkyuu.dev>
Mon, 14 Apr 2025 11:42:39 +0000 (19:42 +0800)
calculate.php [new file with mode: 0644]
index.php [new file with mode: 0644]

diff --git a/calculate.php b/calculate.php
new file mode 100644 (file)
index 0000000..e8cd506
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+  $radius = $_GET["radius"] ?? 0;
+  $circumference = round(2 * pi() * $radius, 2);
+  $area = round(pi() * pow($radius, 2), 2);
+  $volume = round((4 / 3) * pi() * pow($radius, 3), 2);
+
+  echo "<br>If radius of the circle is {$radius}<br>";
+  echo "&nbsp;&nbsp;&nbsp;Its circumference would be: {$circumference}cm <br>";
+  echo "&nbsp;&nbsp;&nbsp;Its area would be: {$area}cm<sup>2</sup> <br>";
+  echo "&nbsp;&nbsp;&nbsp;Its volume would be: {$volume}cm<sup>3</sup>";
+?>
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..3122a91
--- /dev/null
+++ b/index.php
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title>circle</title>
+</head>
+<body>
+  <h1>find the circumference, area, and volume of a circle base on its radius.</h1>
+  <form action="" method="GET">
+    <label for="radius">what is the radius:</label>
+    <input type="value" name="radius" id="radius" required>
+    <input type="submit" value="calculate">
+  </form>
+  <?php include './calculate.php';?>
+</body>
+</html>
\ No newline at end of file