- 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
9 Antworten
+ 1
Yes. Just use primary physics:
1. Use speed and distance to find the time in hours
2. Convert it to minutes
+ 1
Khalx
Attempts?
+ 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.
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
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
0
Khalx
Can you show your code?
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.
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?
0
I do it for the same way but can’t work. Please help me for it 🥲