Can you solve road trip JavaScript first challenge please
1/23/2022 5:18:07 PM
Waqar Ahmad Khan13 Answers
New Answerhave you tried to solve the problem? show the code you wrote, we will help you fix the error.
Waqar Ahmad Khan Do you know the formula of speed? Do you know how many minutes in 1 hour? You have speed and you have distance as input now you can calculate how to get time in minutes.
try this one ↓ function main() { var distance = parseInt(readLine(), 10); var speed = 40 var time = 60 console.log(distance/speed*time); }
A͢J Muhammad Ali thank you so much sir 🥰🥰🥰but i am very weak n math cam it will be a problem in my programming journey
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
function main() { var distance = 40; parseInt(readLine(), 10); //your code goes here var miles = 150; var result = (miles / distance); }
Waqar Ahmad Khan Don't write Hard Code value for distance. Just do this: var distance = parseInt(readLine());
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message