Distance Between 2 Places
Premium Content - Free Preview
You're creating travel software, and need to calculate the distance between 2 locations located at (x1, y1) and (x2, y2) on a 2D grid. You will be given a list of doubles as input in the following order: x1, y1, x2, y2. Calculate and print the distance between the cities, rounded to 3 decimal places.
End of Free Content Preview. Please Sign in or Sign up to buy premium content.
Comments
thales
Jul 20, 12:54 PMIsnt there an esier way to round up numbers to n decimal places?
a solution:
my code
Bolke
Jul 29, 9:05 AMWe have to make a precision, for which there is no method? That's brutal.
Bolke
Jul 29, 9:36 AMI finally got the precision done, but only by copying and pasting a solution for that issue from Quora. It really would be helpful if we were led to a solution, sometimes. Right now I don't feel I'm learning from this.
Learneroo
Jul 31, 5:22 PMIn this case, Googling for how to round numbers would be good practice for real world programming.