0
It was supposed to average 5.4 and appear 48.8 (Recital 2: 4.0 7.5 8.0 6.4)
var entrada = require('readline-sync')
var linha = entrada.question().split(' ')
var segundoValor = entrada.question()
var N1 = parseFloat(linha[0]).toFixed(1)
var N2 = parseFloat(linha[1]).toFixed(1)
var N3 = parseFloat(linha[2]).toFixed(1)
var N4 = parseFloat(linha[3]).toFixed(1)
var media = ((N1 * 2) + (N2 * 3) + (N3 * 4) + (N4 * 1) / 10)
if(media >= 7){
console.log('Media: ', media)
console.log('Aluno aprovado.')
}
Wouldn’t it be because of parentheses? The way you’re doing,
(N4 * 1)
will be divided by 10 before being added with the other values, since division has priority over sum. Try to put the/ 10
outside the parentheses.– Andre
You entered with 5 parameters but you are only considering 4. Would this be it? If not, what is the last parameter for? "6.4".
– Leonardo Getulio
You have 5 numbers in the lobby but only use 4... you can explain this part better so you can answer too?
– Sergio