-
Notifications
You must be signed in to change notification settings - Fork 1
/
calculator.html
39 lines (38 loc) · 960 Bytes
/
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
<!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 square() {
var num = document.getElementById("n1");
num.value = num.value * num.value;
}
function inverse() {
var num = document.getElementById("n1");
num.value = 1/num.value;
}
function four() {
var num = document.getElementById("n1");
num.value = Math.pow(num.value, 4);
}
function sin() {
var num = document.getElementById("n1");
num.value = Math.sin(num.value);
}
</script>
</head>
<body>
<h1>Calculadora de Rosario Pérez Fernández</h1>
Number:
<input type="text" id="n1">
<p>
<button onclick="cube()"> x^3 </button>
<button onclick="square()">x<sup>2</sup> </button>
<button onclick="inverse()">1/x</button>
<button onclick="four()"> x^4 </button>
<button onclick="sin()"> seno </button>
</p>
</body>
</html>