-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathaula07.01.html
More file actions
46 lines (35 loc) · 1.32 KB
/
aula07.01.html
File metadata and controls
46 lines (35 loc) · 1.32 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
<!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>
<div id="output"></div>
</body>
<script>
//matriz
var notas = [
[5,6,4,3], [2,8,5,6], [3,6,4,8], [2,8,4,9]
];
var msg = "";
var mediaAnual = 0;
for(var i = 0; i < notas.length; i++){
console.log(notas[i])
msg += '<p> notas do '+ (i + 1) +' bimestre: '+ notas[i].join(', ') +' </p>'
var totalBimestre = 0;
for(var j = 0; j < notas[i].length; j++){
console.log(notas[i][j])
totalBimestre += notas[i][j]
}
var mediaBimestre = totalBimestre / notas[i].length;
mediaAnual += mediaBimestre;
msg += '<p>A média do '+ (i + 1) +' bimestre é: '+ mediaBimestre+ '</p><hr>'
console.log('mediaBimestre', mediaBimestre);
}
mediaAnual = mediaAnual / notas.length;
msg += '<p> a média anual é: ' + mediaAnual + '</p><hr>'
document.querySelector('#output').innerHTML = msg;
</script>
</html>