- 1

Can anyone pls help me out with this?

You need to plan a road trip. You are traveling at an average speed of 40 miles an hour. Given a distance in miles as input (the code to take input is already present), output to the console the time it will take you to cover it in minutes. Sample Input: 150 Sample Output: 225

10th Oct 2022, 12:22 AM
Khalx
9 Antworten
+ 1
Yes. Just use primary physics: 1. Use speed and distance to find the time in hours 2. Convert it to minutes
10th Oct 2022, 1:03 AM
Emerson Prado
Emerson Prado - avatar
+ 1
Khalx Attempts?
10th Oct 2022, 6:30 AM
A͢J
A͢J - avatar
+ 1
chiiiii You have to take distance as an input like: var distance = parseInt(readLine(), 10); You should print inside the function not outside the function.
11th Oct 2022, 4:28 PM
A͢J
A͢J - avatar
0
I know how to solve it, the way I write the code isn't the sololearn style, I just need to know the way they'd want me to write it
10th Oct 2022, 1:54 PM
Khalx
0
I assigned 150 to be the value of the distance and 40 for speed then I used basic JavaScript mathematical representation, yet I be getting error for input and output, don't know what to do
10th Oct 2022, 2:02 PM
Khalx
0
Khalx Can you show your code?
10th Oct 2022, 2:57 PM
A͢J
A͢J - avatar
0
Khalx Pls edit your question description to inform what you really need. And, of course, also include in the question description a link to your code.
11th Oct 2022, 12:28 AM
Emerson Prado
Emerson Prado - avatar
0
Here's the code sir function main() { var distance = 150 var speed = 40 var time = (distance / speed) * 60 parseInt(readLine(), 10); //your code goes here } console.log(time); Pls what did I do wrong?
11th Oct 2022, 1:37 PM
Khalx
0
I do it for the same way but can’t work. Please help me for it 🥲
11th Oct 2022, 2:34 PM
chiiiii