...

/

Example 7: Distance Between the Two Points

Example 7: Distance Between the Two Points

Learn how to calculate the distance between two points on Earth.

We'll cover the following...

Problem

Write a program that receives latitude values (L1, L2) and longitude (G1, G2) of two places on Earth, in degrees, and returns the distance between them.

The formula for distance in nautical miles is:

D = 3963 * acosacos ( sinL1sinL2\sin L1 * \sin L2 ...

Access this course and 1400+ top-rated courses and projects.