- 39
You need to plan a road trip. You are traveling at an average speed of 40 miles an hour.
Output =225
31 Respuestas
+ 9
function main() {
var distance = parseInt(readLine(), 10);
const speed = 40
const time = distance/speed
const timeInMinutes = time * 60
console.log(timeInMinutes)
}
//The formula is for distace input -> time =(distace*valucity)*60
// The formula is for time input -> distance = velocity * (time/60)
+ 4
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
console.log((distance/40)*60)
}
+ 1
This is the right answer
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
const speed = 40;
const time = distance/speed;
const timeInMinutes= time*60;
console.log(timeInMinutes );
}
+ 1
function main() {
var distance = parseInt(readLine(), 10);
const speed = 40
const time = distance/speed
const timeInMinutes = time * 60
console.log(timeInMinutes)
}
//The formula is for distace input -> time =(distace*valucity)*60
// The formula is for time input -> distance = velocity * (time/60)
Good Luck
0
Actually I don't know so plz can you help with exact code in JavaScript
0
Ok thank you
0
Ya I know the logic but I don't know how to implement this
0
Yes thanks alot
0
The spec seems incomplete
0
Pradnya Kolhe Please justify your full doubt!!! And where is your code???
0
Think about what are the inputs and outputs of your program and what are the known constants etc. How will you take input? What processing will you do to the input data? How will you provide the output?
0
Here's a small implementation of the idea:
(Of course it's not Javascript but you should be able to do it)
https://code.sololearn.com/cO4sXnHdFBS1/?ref=app
0
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
const speed = 40
const time = distance/speed
const timeInMinutes = time * 60
console.log(timeInMinutes)
}
0
Thanks Mahnoor Shahzad I had the same doubt because in the course they haven't teach constant yet so i didnt know about constant just variables so i was too confused.
0
Hey guys this is the simplest approach
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
const speed = 40;
const time = distance/speed;
const timeInMinutes= time*60;
console.log(timeInMinutes );
}
0
const main = () => {
var distance = parseInt(readLine(), 10)
var hora = distance/40;
var minuto = hora*60;
console.log(minuto)
}
0
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
const speed = 40;
const time = distance/speed;
console.log(time*60 );
}
0
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
x= (distance/40)*60 ;
console.log(x)
}
0
function main() {
var distance = parseInt(readLine(), 10);
const speed = 40
const time = distance/speed
const timeInMinutes = time * 60
console.log(timeInMinutes)
}
0
function main() {
var distance = parseInt(readLine(), 10);
const speed = 40
const time = distance/speed
const timeInMinutes = time * 60
console.log(timeInMinutes)
}