+ 1

please fix the javascript problem

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

14th Oct 2021, 1:52 PM
Abdur Rahman Roky
Abdur Rahman Roky - avatar
4 Answers
0
Revma I just don't understand how to solve it. Help me
14th Oct 2021, 2:08 PM
Abdur Rahman Roky
Abdur Rahman Roky - avatar
0
See, You first take the input of the distance. Then, you do the math calculations, so the sample input here is 150, and the formula to get the time is, distance/time, so here, the distance is 150, and the speed is 40 miles per hour, so 150/40 = 3.75. Now because the speed was 40 miles per hour, the time is also going to be in hours, and a hour contains 60 minutes, so we multiply 3.75 hours by 60, so now, it is converted into 225 minutes. Now, the calculations in JavaScript, var time = input_distance / 40 * 60;
21st Oct 2021, 7:50 PM
≠Homñn£y≠
≠Homñn£y≠ - avatar