#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float l1,l2,g1,g2, D;
printf("\nEnter (two) the values of lattitude : ");
scanf("%f%f", &l1, &l2);
printf("\nEnter (two) the values of longitude : ");
scanf("%f%f", &g1, &g2);
D = 3963*acos(sin(l1)*sin(l2) + cos(l1)*cos(l2)*cos(g2-g1));
printf("\nDistance : %f", D);
getch();
return 0;
}
Ad
Chapter - 2: C Instructions
Write a program to receive values of latitude and longitude in degrees, of two places on earth and outputs the distance between them in nautical miles. The formula for distance in nautical.
Ad
Ad