TOPIC

Erro na validação

gldcarvalho0 asked 2 years ago

Alguem consegue me ajudar a entender o que esta errado? testei as saidas no uDebug e deram certas lá

var valores = lines[0].split(' ');

function checker(valores) {
    var a = parseInt(valores[0]);
    var b = parseInt(valores[1]);
    var c = parseInt(valores[2]);
    var d = parseInt(valores[3]);

    if (b < c)
        return false;
    if (d < a)
        return false;
    if (d + c < a + b)
        return false;
    if (d + c < 0 || a + b < 0)
        return false;
    if (a % 2)
        return false;
    return true;
}

if (checker(valores))
    console.log("Valores aceitos");
else
    console.log("Valores nao aceitos");

Remember not post solutions. Your post may be reviewed by our moderators.