0

Road trip

Can you solve road trip JavaScript first challenge please

23rd Jan 2022, 5:18 PM
Waqar Ahmad Khan
Waqar Ahmad Khan - avatar
13 Réponses
+ 2
Waqar Ahmad Khan No math will not be affect on your programming journey.
23rd Jan 2022, 5:41 PM
A͢J
A͢J - avatar
+ 3
Waqar Ahmad Khan no problem bro
23rd Jan 2022, 5:39 PM
Muhammad Ali
Muhammad Ali - avatar
+ 1
have you tried to solve the problem? show the code you wrote, we will help you fix the error.
23rd Jan 2022, 5:23 PM
Muhammad Ali
Muhammad Ali - avatar
+ 1
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.
23rd Jan 2022, 5:24 PM
A͢J
A͢J - avatar
+ 1
try this one ↓ function main() { var distance = parseInt(readLine(), 10); var speed = 40 var time = 60 console.log(distance/speed*time); }
23rd Jan 2022, 5:26 PM
Muhammad Ali
Muhammad Ali - avatar
+ 1
Waqar Ahmad Khan Just multiply with 60 in result to get in minutes.
23rd Jan 2022, 5:26 PM
A͢J
A͢J - avatar
+ 1
Ok wait i am trying sir aj and ali bhai
23rd Jan 2022, 5:27 PM
Waqar Ahmad Khan
Waqar Ahmad Khan - avatar
+ 1
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
23rd Jan 2022, 5:38 PM
Waqar Ahmad Khan
Waqar Ahmad Khan - avatar
+ 1
Thank you so much from the core of my heart ❤️
23rd Jan 2022, 5:45 PM
Waqar Ahmad Khan
Waqar Ahmad Khan - avatar
0
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
23rd Jan 2022, 5:24 PM
Waqar Ahmad Khan
Waqar Ahmad Khan - avatar
0
function main() { var distance = 40; parseInt(readLine(), 10); //your code goes here var miles = 150; var result = (miles / distance); }
23rd Jan 2022, 5:24 PM
Waqar Ahmad Khan
Waqar Ahmad Khan - avatar
0
This is my code A͢J Muhammad Ali
23rd Jan 2022, 5:25 PM
Waqar Ahmad Khan
Waqar Ahmad Khan - avatar
0
Waqar Ahmad Khan Don't write Hard Code value for distance. Just do this: var distance = parseInt(readLine());
23rd Jan 2022, 5:27 PM
A͢J
A͢J - avatar