+ 1
Javascript math operator 2
n the office, 2 monitors are connected to each computer. The first line of the given code takes the number of computers as input. Tasklbl Complete the code to calculate and output the number of monitors to the console. Sample Input 10 Sample Output 20 Hint Since each computer has 2 monitors, simply multiply the count of the computers by 2. This how i did it but it is wrong Console.log(18*2) Console.log(20*2) Console.log(6*2) And the rest is hidden i can not see i need help guys this make me confuse
11 Respuestas
+ 1
take user input into a variable
and use
console.log(input*2) ;
Complete lesson of 'taking user input.'
+ 1
In the given code, you'll find the line:
var computers = parseInt(readLine(), 10);
Do not remove this line but take the computers variable for your calculation!
+ 1
You need only log to console once. Replace the 1st number with "computers" variable.
+ 1
Which number ?
+ 1
The number in console.log. You need to multiply "computer" not fixed numbers.
+ 1
"var computers = parseInt(readLine(), 10)
console.log(18*2)
console.log(20*2);.... " :
From the above, you have input into variable 'computers' so why to use 18*.. or 20*.. ?
Just use and output
var computers = parseInt(readLine(), 10)
console.log(computers*2 )
+ 1
Sometimes something so easy can knock you out thank you guys for helping me out
+ 1
var comp = prompt ("Input number of computers");
console.log(comp * 2);
0
var computers = parseInt(readLine(), 10)
console.log(18*2)
console.log(20*)
console.log(6*2)
0
You have to leave the first line as it creates a user input for the app, then write a code to process the numbers which was input by the user.
var computers = parseInt(readLine(), 10)
//your code goes here
var monitors = 2
var totalmonitors = monitors * computers
console.log(totalmonitors);