-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathaula04.01_exercicio.html
More file actions
65 lines (52 loc) · 1.85 KB
/
aula04.01_exercicio.html
File metadata and controls
65 lines (52 loc) · 1.85 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!doctype html>
<html>
<head>
<title>Logica de Programação Javascript</title>
<meta charset="utf-8">
</head>
<body>
<h1>Lógica de programação com Javascript</h1>
<button onclick="somar()">+</button>
<button onclick="subtrair()">-</button>
<button onclick="multiplicar()">*</button>
<button onclick="dividir()">/</button>
<div id="output"></div>
<script>
var n1 = prompt('digite um numero');
n1 = parseFloat(n1);
escreve();
function escreve(){
var output = document.querySelector('#output');
output.innerHTML = n1;
}
function somar(){
var n = prompt('digite outro numero');
n = parseFloat(n);
//n1 = n1 + n;
n1 += n;
escreve();
}
function subtrair(){
var n = prompt('digite outro numero');
n = parseFloat(n);
//n1 = n1 - n;
n1 -= n;
escreve();
}
function multiplicar(){
var n = prompt('digite outro numero');
n = parseFloat(n);
//n1 = n1 * n;
n1 *= n;
escreve();
}
function dividir(){
var n = prompt('digite outro numero');
n = parseFloat(n);
//n1 = n1 / n;
n1 /= n;
escreve();
}
</script>
</body>
</html>