0
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var i, p;
console.log(a);
p = 0;
{
for(i = 1; i <= 6; i = i + 1);
if(x > 0.0){
p = p + 1;
}
console.log(p + ' valores positivos');
}
I have to use this code to read 6 numbers (Lines[0] up to Lines[5]) and show how many are positive, but I don’t know how to create a var that reads all lines as numbers, I tried to use var x = [Lines[0], Lines[1], ..., Lines[5]]; however it reads as a string and I can’t use x.split(","); How should I do? Standard input:
7; -5; 6; -3.4; 4.6; 12;