You need to plan a road trip. You are traveling at an average speed of 40 miles an hour. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 39

You need to plan a road trip. You are traveling at an average speed of 40 miles an hour.

Output =225

13th Dec 2020, 9:52 AM
Pradnya Kolhe
Pradnya Kolhe - avatar
30 Answers
+ 9
function main() { var distance = parseInt(readLine(), 10); const speed = 40 const time = distance/speed const timeInMinutes = time * 60 console.log(timeInMinutes) } //The formula is for distace input -> time =(distace*valucity)*60 // The formula is for time input -> distance = velocity * (time/60)
14th Jun 2021, 3:46 PM
Fahima Akter
Fahima Akter - avatar
+ 4
function main() { var distance = parseInt(readLine(), 10); //your code goes here console.log((distance/40)*60) }
19th Jun 2021, 5:26 AM
Sucharya Deshmukh
Sucharya Deshmukh - avatar
+ 1
This is the right answer function main() { var distance = parseInt(readLine(), 10); //your code goes here const speed = 40; const time = distance/speed; const timeInMinutes= time*60; console.log(timeInMinutes ); }
16th Apr 2021, 3:29 PM
Anshuman Raj
Anshuman Raj - avatar
+ 1
function main() { var distance = parseInt(readLine(), 10); const speed = 40 const time = distance/speed const timeInMinutes = time * 60 console.log(timeInMinutes) } //The formula is for distace input -> time =(distace*valucity)*60 // The formula is for time input -> distance = velocity * (time/60) Good Luck
13th Dec 2021, 2:19 AM
Muhammad Alif Deva Rizqon
Muhammad Alif Deva Rizqon - avatar
0
Actually I don't know so plz can you help with exact code in JavaScript
13th Dec 2020, 10:27 AM
Pradnya Kolhe
Pradnya Kolhe - avatar
0
Ok thank you
13th Dec 2020, 10:30 AM
Pradnya Kolhe
Pradnya Kolhe - avatar
0
Ya I know the logic but I don't know how to implement this
13th Dec 2020, 10:37 AM
Pradnya Kolhe
Pradnya Kolhe - avatar
0
Yes thanks alot
13th Dec 2020, 10:40 AM
Pradnya Kolhe
Pradnya Kolhe - avatar
0
The spec seems incomplete
14th Dec 2020, 7:32 AM
Sonic
Sonic - avatar
0
Pradnya Kolhe Please justify your full doubt!!! And where is your code???
14th Dec 2020, 5:09 PM
Abhinav Raj
Abhinav Raj - avatar
0
Think about what are the inputs and outputs of your program and what are the known constants etc. How will you take input? What processing will you do to the input data? How will you provide the output?
14th Dec 2020, 11:55 PM
Sonic
Sonic - avatar
0
Here's a small implementation of the idea: (Of course it's not Javascript but you should be able to do it) https://code.sololearn.com/cO4sXnHdFBS1/?ref=app
15th Dec 2020, 4:03 AM
Boay.JS
Boay.JS - avatar
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here const speed = 40 const time = distance/speed const timeInMinutes = time * 60 console.log(timeInMinutes) }
4th Apr 2021, 6:09 PM
Mahnoor Shahzad
Mahnoor Shahzad - avatar
0
Thanks Mahnoor Shahzad I had the same doubt because in the course they haven't teach constant yet so i didnt know about constant just variables so i was too confused.
14th Apr 2021, 9:46 PM
Alejandro Cifuentes
Alejandro Cifuentes - avatar
0
Hey guys this is the simplest approach function main() { var distance = parseInt(readLine(), 10); //your code goes here const speed = 40; const time = distance/speed; const timeInMinutes= time*60; console.log(timeInMinutes ); }
5th Apr 2022, 12:41 PM
Solahudeen Abdulrahmon
Solahudeen Abdulrahmon - avatar
0
const main = () => { var distance = parseInt(readLine(), 10) var hora = distance/40; var minuto = hora*60; console.log(minuto) }
30th Aug 2022, 5:07 AM
Jhossep Llacctahuaman C.
Jhossep Llacctahuaman C. - avatar
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here const speed = 40; const time = distance/speed; console.log(time*60 ); }
24th Oct 2022, 9:02 AM
Rahel Hailu
Rahel Hailu - avatar
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here x= (distance/40)*60 ; console.log(x) }
30th Oct 2022, 1:12 PM
Ismail ECH-CHARAI
0
function main() { var distance = parseInt(readLine(), 10); const speed = 40 const time = distance/speed const timeInMinutes = time * 60 console.log(timeInMinutes) }
22nd Dec 2022, 4:10 PM
James Joshua
James Joshua - avatar
0
function main() { var distance = parseInt(readLine(), 10); const speed = 40 const time = distance/speed const timeInMinutes = time * 60 console.log(timeInMinutes) }
2nd Apr 2023, 7:21 AM
Brayan Ngowi
Brayan Ngowi - avatar