You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
938 B
HTML

<!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 = Math.pow(num.value, 2);
}
function inverse() {
var num = document.getElementById("n1");
num.value = Math.pow(num.value, -1);
}
function fourth() {
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 Fernando Sánchez</h1>
Number:
<input type="text" id="n1"><p>
<button onclick="cube()"> x^3 </button>
<button onclick="square()"> x^2 </button>
<button onclick="inverse()"> 1/x </button>
<button onclick="fourth()"> x^4 </button>
<button onclick="sin()"> sin(x) </button>
</body>
</html>