It is printing right because 2 divided by 7 + 9.3 will always give mean less than 5.9.
See your code running
var p1 = Number ('7.0')
var p2 = Number ('9.3')
const media = 2 / (p1 + p2)
console.log(media);
if (media > 5.9) {
console.log("Aprovado")
} else {
console.log("Reprovado")
};
Correct is the reverse of this division, see
var p1 = Number ('7.0')
var p2 = Number ('9.3')
const media = 1/(2 / (p1 + p2))
console.log(media);
if (media > 5.9) {
console.log("Aprovado")
} else {
console.log("Reprovado")
};
Complicated?
Because the denominator has a fraction, then we use that familiar rule:
repeats the first and multiplies by the inverse of the second, that is, repeats the numerator and multiplies by the inverse of the denominator.
p1+p2
1 x _______ = (p1+p2)/2
2
They will not say that my answer is the same as other non-heim: D