TOPIC

Wrong answer (100%)

Guilherme241 asked 1 year ago

Não faço a minima ideia do que esteja errado nesse código:

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

var codigo = parseInt(lines.shift());
var quant = parseInt(lines.shift());
var calculo = 0;

switch(codigo){
        case 1: 
        calculo = quant*4.00
        console.log(`Total: R$ ${calculo.toFixed(2)}`);
        break;
        case 2:
        calculo = quant*4.50
        console.log(`Total: R$ ${calculo.toFixed(2)}`);
        break;
        case 3:
        calculo = quant*5.00
        console.log(`Total: R$ ${calculo.toFixed(2)}`);
        break;
        case 4: 
        calculo = quant*2.00
        console.log(`Total: R$ ${calculo.toFixed(2)}`);
        break;
        case 5: 
        calculo = quant*1.50
        console.log(`Total: R$ ${calculo.toFixed(2)}`);
        break;
        default: console.log("Valor inválido.");

  }

This topic has not been answered yet. Be the first!

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