Our programming assignment asked us to find the distance between two cities. We were given the cities, their latitudes and longitudes and an equation to plug in. We were also given the answers, so all we had to do was write a code that spit out answers that matched the ones given. I wrote a code that works, but gives me the incorrect answers. I am wondering if I input the latitude and longitude incorrectly. Here's an example of what was given and how I wrote it in code:
Prague's Latitude = N 50 degrees, 15 arc-minutes (1 degree = 60 arc-minutes) Prague's Longitude = E 14 degrees, 26 arc-minutes
I wrote this in code as:
pragueLatitude = 50 + (15*(1/60)); pragueLongitude = 14 + (26(1/60));
While this gave me an answer, it was not the correct answer. Is there anything I am doing wrong on the coding end? Perhaps with the direction (the N/E in the give latitude and longitude). Any help would be greatly appreciated! Thanks.