It’s printing right because 2 divided by 7+9.3 will always give average less than 5.9.
see your code run
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")
};
The correct is the inverse 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?
as in the denominator has a fraction, so we use that known rule:
repeats the first and multiplies by the inverse of the second, i.e., repeats the numerator and multiplies by the inverse of the denominator.
p1+p2
1 x _______ = (p1+p2)/2
2
will not say that my answer is the same as the others not heim :D
What’s wrong? How should it be? How is it coming out?
– CypherPotato