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