#include<stdio.h>
#include<math.h>
int main(){
float L1,L2,G1,G2,D;
printf("Enter The Latitudes: (L1,L2) :");
scanf(" %f, %f \n",&L1,&L2);
printf("Enter The Longitudes: (G1,G2) :");
scanf(" %f, %f \n",&G1,&G2);
D = 3963 *acos(sin(L1)*sin(L2) + cos(L1)*cos(L2)*cos(G2-G1));
printf("Distance In Nautical Miles: %f",D);
return 0;
}
The Second scanf
is being ignored I guess and I have read many previous related answers and they were all about %c
. but in my case it is %f
.
Help will be appreciated.