Question: i need help writing this c code using notepad++. Using the Pythagorean Theorem, we see that R^2 + d^2 = (R + h)^2 And solving

i need help writing this c code using notepad++. i need help writing this c code using notepad++. Using the Pythagorean

Using the Pythagorean Theorem, we see that R^2 + d^2 = (R + h)^2 And solving for the distance, yields d = Squareroot h^2 + 2Rh Find the distance to the horizon on the earth and on the moon, for the mountains from 0 to 8000 meter (using a loop with 500 meters increment). The radius of the earth is 6378 kilometers and radius of the moon is 1737 kilometers. For this assignment, you must follow directions exactly. Create a program with a main() function and a distance() function. The distance() function takes two parameters, the height (h) and the radius (R), apply the Pythagorean Theorem to compute the distance (d) and return d to the caller (the main() function). The main() function needs to open a file (Radius) to get the radius (R) of both moon and earth from the opened file respectively, it passes both R and h to distance() for the result of d. You need a loop in main() function to output the distances of moon and earth where the height h starts from 0 meter to 8000 meters with 500 meters increment. Your output to the console should be exactly as the followings

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!