-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.html
50 lines (41 loc) · 1.2 KB
/
calculator.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<title>Calculator</title>
<meta charset="utf-8">
<script type="text/javascript">
function cube() {
var num = document.getElementById("n1");
num.value = Math.pow(num.value, 3);
}
function sin() {
var num = document.getElementById("n1");
num.value = Math.sin(num.value);
}
function four() {
var num = document.getElementById("n1");
num.value = Math.pow(num.value, 4);
}
function square() {
var num = document.getElementById("n1");
num.value = Math.pow(num.value, 2);
}
function inverse() {
var num = document.getElementById("n1");
num.value = 1/num.value;
}
</script>
</head>
<body>
<h1>Calculadora de Álvaro García Sánchez</h1>
Number:
<input type="text" id="n1">
<p>
<button onclick="cube()"> x^3 </button>
<button onclick="sin()"> sin(x) </button>
<button onclick="four()"> x^4 </button>
<button onclick="square()"> x^2 </button>
<button onclick="inverse()"> 1/x </button>
</p>
</body>
</html>