-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathWhile.js
More file actions
15 lines (14 loc) · 466 Bytes
/
While.js
File metadata and controls
15 lines (14 loc) · 466 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var ordinais = ['primeira', 'segunda', 'terceira', 'quarta'];
var media = 0;
var i = 0;
while (i < ordinais.length) {
var nota = prompt("Informe a " + ordinais[i] + " nota: ");
if (nota === "" || !nota) nota = 0;
media += parseFloat(nota);
i++;
}
media /= ordinais.length;
if (media >= 7) document.write("Aprovado");
else if (media <= 5) document.write("Reprovado");
else document.write("Recuperação");
//https://pt.stackoverflow.com/q/484122/101