+ 2
How many hour will it take the plane to get to sydney?
I'm supposed to calculate a flight time from LA to sydney. Total distance is 7425 miles and the planes cover 550 miles per hour.
10 odpowiedzi
+ 3
bernard like, only 13 and not 13.5?
It's because integer division is taking place and it only shows the integer part. Use floating point division. Instead of doing this:
x=7425/550
Do this:
x=7425.0/550
As we used a double value in the second division, the interpreter will choose floating point division here and result in the correct value 13.5
+ 2
Use math to solve the problem. If the plane covers 550 miles per hour, how many hours will it take to cover 7425 miles? We can use proportionality here
550:1=7425:x
x is the number of hours we have to find. This can be written as:
550/1=7425/x
Simplify it and take x on left side, we get,
x/1=7425/550
Which is,
x=13.5 hours
So it'll take exactly 13.5 house for our ideal plane which travels at constant velocity, to reach 7425 miles. Applying this in your code is left as an exercise to you =)
PS: Don't sleep during your maths class 😗
+ 1
Ok
+ 1
Jay Matthews
No wonder we have so much COVID, everybody keeps visiting.
🤣😂🤣
+ 1
bernard dont forget to take the vaccine first 🙂
0
I couldn't believe the answer was so simple, but it is just
print(7425/550)
0
Elliot Owen Nah, it's
print(7425.0/550)
0
D_Stark
2 doses minimum, a mask & 2 weeks of social isolation.
Welcome to Australia
0
Using math formulas
Td=7425
Dph=550
If 550 miles is taken an hour
Then divide 7425 by 559 to get
how many hours it will take
7425÷550
=13.5