mirror of
https://gitlab.com/tutorial-java-rafa-munoz/tutorial-java-2024-25/LMSGI-2024-25.git
synced 2025-11-09 09:57:39 +01:00
27 lines
673 B
HTML
27 lines
673 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
|
|
<script>
|
|
// Muestra en un p el área de un círculo con un radio
|
|
// ingresado por el usuario.
|
|
const PI = 3.1416;
|
|
function calcularArea() {
|
|
let radio = document.getElementById("radio").value;
|
|
let area = PI * radio * radio;
|
|
document.getElementById("area").innerText = 'Área: ' + area ;
|
|
} </script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<input type="number" id="radio" placeholder="Ingresa el radio">
|
|
<button onclick="calcularArea()">Calcular Área</button>
|
|
<p id="area"></p>
|
|
|
|
|
|
</body>
|
|
|
|
</html> |