27.0k views
0 votes
Write a C program to calculate and display the acceleration due to gravity at the surface of the earth(g), by using the formula, where, G is gravitational constant, M is mass of the earth and R is radius of the earth

1 Answer

3 votes

Final answer:

To calculate and display the acceleration due to gravity at the surface of the earth (g) in a C program, use the given formula and provide values for G, M, and R. Here's an example program in C that demonstrates this calculation.

Step-by-step explanation:

To calculate and display the acceleration due to gravity at the surface of the earth (g) in a C program, you can use the given formula:

g = (G * M) / (R * R)

where G is the gravitational constant (6.67 x 10^-11 N.m^2 / kg^2), M is the mass of the earth (5.9726 x 10^24 kg), and R is the radius of the earth (6,356 km or 6,356,000 meters).

Here's an example program in C:

#include <stdio.h>
#include <math.h>

int main() {
double G = 6.67 * pow(10, -11);
double M = 5.9726 * pow(10, 24);
double R = 6.356 * pow(10, 6);
double g = (G * M) / (R * R);
printf("The acceleration due to gravity at the surface of the earth is %.2f m/s^2\\", g);
return 0;
}

When you run this program, it will calculate and display the value of g, which represents the acceleration due to gravity at the surface of the earth.

User Maelle
by
8.5k points

No related questions found