-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculadora.js
39 lines (31 loc) · 1.02 KB
/
calculadora.js
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
let valor1 = document.querySelector('#valor1');
let valor2 = document.querySelector('#valor2');
let resul = document.querySelector('#resul');
let btsoma = document.querySelector('#btsoma')
btsoma.addEventListener("click", function() {
soma(Number(valor1.value), Number(valor2.value))
})
function soma(a, b) {
resul.textContent = (a + b)
}
let btsubtracao = document.querySelector('#btsubtracao')
btsubtracao.addEventListener("click", function() {
subtracao(Number(valor1.value), Number(valor2.value))
})
function subtracao(a, b) {
resul.textContent = (a - b)
}
let btdivisao = document.querySelector('#btdivisao')
btdivisao.addEventListener("click", function() {
divisao(Number(valor1.value), Number(valor2.value))
})
function divisao(a, b) {
resul.textContent = (a / b)
}
let btmultplicacao = document.querySelector('#btmultplicacao')
btmultplicacao.addEventListener("click", function() {
multiplica(Number(valor1.value), Number(valor2.value))
})
function multiplica(a, b) {
resul.textContent = (a * b)
}