Can someone please help me with this task | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone please help me with this task

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

24th Feb 2022, 12:21 PM
Chidubem Nwabia
Chidubem Nwabia - avatar
5 Answers
+ 2
Chidubem Nwabia change 150 with distance variable y = distance * 60 / 40;
24th Feb 2022, 12:48 PM
A͢J
A͢J - avatar
+ 1
Hey Chidubem Nwabia Can you show what you are trying to solve it ? So that other may point out where you're making mistake(s)
24th Feb 2022, 12:29 PM
Mohd Aadil
Mohd Aadil - avatar
+ 1
Hey Mohd Aadil this is it function main() { var distance = parseInt(readLine(), 10); //your code goes here var x= 150/40; var y= x*60; console.log(y); }
24th Feb 2022, 12:35 PM
Chidubem Nwabia
Chidubem Nwabia - avatar
+ 1
Hey A͢J Thank you very much.
24th Feb 2022, 5:11 PM
Chidubem Nwabia
Chidubem Nwabia - avatar