Trip planner | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Trip planner

It’s not running function main() { var distance = parseInt(readLine(), 10); //your code goes here var distance = 590 var speed = 40 var minutes = distance / speed console.log(minutes *60); } function main() { var distance = parseInt(readLine(), 10); //your code goes here var distance2 = 100 var speed2 = 40 var minutes2 = distance2 / speed2 console.log(minutes2 *60) }

12th Dec 2020, 9:14 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
18 Answers
+ 32
Use this : function main() { var distance = parseInt(readLine(), 10); //your code goes here var speed = 40 var time = 60 var minutes = distance/speed console.log(minutes*time) }
13th Dec 2020, 2:51 PM
Rahfi
Rahfi - avatar
+ 17
Emmanuel Osemudiamen , the purpose of the task is not to give certain values like 590 or 100 as input and call the function by yourself many times. The input value is distance. Just perform the calculation this way: function main() { var distance = parseInt(readLine(), 10); //your code goes here var speed = 40 var minutes = distance / speed; console.log(minutes *60); }
12th Dec 2020, 9:55 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 3
Your welcome
21st May 2021, 2:11 PM
Rahfi
Rahfi - avatar
+ 1
function main() { var distance = parseInt(readLine(), 10); var output = distance/40; console.log(output*60); } main(150);
19th Feb 2021, 7:45 AM
Ayush Sanj
Ayush Sanj - avatar
0
function main() { var distance = parseInt(readLine(), 10); // readLine() means it will take users input, 10 indicate base 10 numeral system. // parseint() returns the integer of the number. var speed = 40 var time = 60 console.log((distance/speed)*time); }
25th Feb 2021, 1:38 AM
Ernesto Canales
0
Rahfi, thanks man for a superb easy method.
21st May 2021, 2:01 PM
Abdullah Al Masud
Abdullah Al Masud - avatar
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here var x= distance/40; var y=60; console.log(x*y) }
31st Jul 2021, 3:02 AM
Machibe
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here var speed= distance/40; var time=60*speed; console.log(time) }
31st Jul 2021, 3:05 AM
Machibe
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here var miles = 40; var minutes = distance / miles; console.log(distance / 40 * 60) } its working
17th Aug 2021, 12:09 PM
Swadhin Kumar
Swadhin Kumar - avatar
0
That is Simple : average speed of 40 miles an hour, so 60 is 1.5 times of 40 . think simply 😎😎😎😎😎😎 function main() { var distance = parseInt(readLine(), 10); //your code goes here var time = distance*1.5; console.log(time); }
24th Aug 2021, 10:34 AM
MD RAKIBUL HASSAN NAYON
MD RAKIBUL HASSAN NAYON - avatar
0
what's meaning of (readline(),10)? didn't understand for it
22nd Sep 2021, 12:17 AM
Cahyo
Cahyo - avatar
0
💯 function main() { var distance = parseInt(readLine(), 10); //your code goes here var speed = 40 var time = 60 var minutes = distance/speed console.log(minutes*time) }
12th Dec 2021, 2:29 AM
MN FATHIMA RIHAM - s92064451 -321424451
MN FATHIMA RIHAM - s92064451 -321424451 - avatar
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here var speed=40; var time=distance/speed; var minutes=time*60; console.log(minutes); }
23rd May 2022, 2:14 AM
Saksham Singh
0
function main() { var distance = parseInt(readLine(), 10); //your code goes here var speed = 40; var time = 60; var minite = distance/speed; var total = minite * time; console.log(total); } You should Try This.!!
12th Aug 2022, 3:44 PM
Ronit Zinzuvadiya
Ronit Zinzuvadiya - avatar
0
function main() { var distance = parseInt(readLine(), 10); // readLine() means it will take users input, 10 indicate base 10 numeral system. // parseint() returns the integer of the number. var speed = 40 var time = 60 console.log((distance/speed)*time); }
17th Sep 2022, 2:56 PM
Kanisak Shakya
Kanisak Shakya - avatar
0
MD RAKIBUL HASSAN NAYON thanks
20th Oct 2022, 8:33 PM
Fabian Flores
Fabian Flores - avatar
0
Im too lazy to write everything so my answer to this is let x = parseInt(readLine(), 10); console.log((x/40) * 60);
22nd Aug 2023, 1:16 PM
Wellaway
Wellaway - avatar
- 4
rafi are you there
17th Dec 2020, 12:35 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar