+ 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

21st Mar 2022, 3:52 PM
Hussein
Hussein - avatar
11 Respostas
+ 1
take user input into a variable and use console.log(input*2) ; Complete lesson of 'taking user input.'
21st Mar 2022, 3:55 PM
Jayakrishna 🇼🇳
+ 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!
21st Mar 2022, 3:57 PM
Lisa
Lisa - avatar
+ 1
You need only log to console once. Replace the 1st number with "computers" variable.
21st Mar 2022, 4:07 PM
Lisa
Lisa - avatar
+ 1
Which number ?
21st Mar 2022, 4:14 PM
Hussein
Hussein - avatar
+ 1
The number in console.log. You need to multiply "computer" not fixed numbers.
21st Mar 2022, 4:17 PM
Lisa
Lisa - avatar
+ 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 )
21st Mar 2022, 4:29 PM
Jayakrishna 🇼🇳
+ 1
Sometimes something so easy can knock you out thank you guys for helping me out
21st Mar 2022, 4:39 PM
Hussein
Hussein - avatar
+ 1
var comp = prompt ("Input number of computers"); console.log(comp * 2);
21st Mar 2022, 7:53 PM
Olufikayomi Jetawo
0
var computers = parseInt(readLine(), 10) console.log(18*2) console.log(20*) console.log(6*2)
21st Mar 2022, 4:03 PM
Hussein
Hussein - avatar
21st Mar 2022, 4:27 PM
Hussein
Hussein - avatar
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);
2nd Apr 2024, 2:42 PM
Adeleye Matthew
Adeleye Matthew - avatar