What's up,

I'm writing a program in C to calculate the distance between two latitude/longitude coordinates. the below code is that I wrote. It is not working for some reason and I'm clueless to what is wrong. Maby you can catch something that I'm missing. You have any ideas? Any help would be great. Thanks in advance!

Peace

Wise1

Code:#include<stdio.h> #include<math.h> #include<conio.h> main(){ //Declarations double pi=3.14159265358979,a,c,d,dlat,dlon,lat1,lat2,lon1,lon2; int days,hours,s,r=3956; //Header printf("Origin Coordinates \n 1) 16, 64 \t\t Speed: 20 mph \n 2) 32, 64 (Bermuda) \t Speed: 10 mph \n\nDestination Coordinates \n 1) 26, 80 (Ft. Lauderdale) \n\n\n"); //Read Input printf("Please Enter the Origin Coordinates: "); scanf("%f, %f",&lat1,&lon1); printf("Please Enter the Destination Coordinates: "); scanf("%f, %f",&lat2,&lon2); printf("Please Enter the Speed of Travel: "); scanf("%d",&s); //Convert Coordinates From Decimal Degrees to Radians lat1*=pi/180; lat2*=pi/180; lon1*=pi/180; lon2*=pi/180; //The Haversine Formula dlat=lat2-lat1; dlon=lon2-lon1; a=((sin(dlat/2))*(sin(dlat/2)))+cos(lat1)*cos(lat2)*((sin(dlon/2))*(sin(dlon/2))); c=2*atan2(sqrt(a),sqrt(1-a)); d=r*c; //Find Time hours=d/s; days=hours/24; hours-=days*24; //Print Output printf("\n\nDistance: %f Statute Miles \nSpeed: %d mph\nTime (Days/Hours): %d/%d",d,s,days,hours); getch(); }