-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise1.html
More file actions
30 lines (22 loc) · 840 Bytes
/
Exercise1.html
File metadata and controls
30 lines (22 loc) · 840 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Exercise 1</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script type="text/javascript">
//Crea un programa por el cual se solicite al usuario el radio de un círculo.
//El programa deberá calcular y mostrar el área
let radio = parseFloat(prompt('Ingrese el radio'));
function calculateAreaOfACircle(radio) {
let area = Math.PI * Math.pow(radio, 2);
return area.toFixed(2);
}
alert(`El radio es ${calculateAreaOfACircle(radio)}`);
</script>
</body>
</html>