140k views
0 votes
Compute the acceleration of gravity for a given distance from the earth's center, distCenter, assigning the result to accelGravity. The expression for the acceleration of gravity is: (G * M) / (d2), where G is the gravitational constant 6.673 x 10-11, M is the mass of the earth 5.98 x 1024 (in kg) and d is the distance in meters from the earth's center (stored in variable distCenter).Sample program:#include int main(void) { const double G = 6.673e-11; const double M = 5.98e24; double accelGravity = 0.0; double distCenter = 0.0; distCenter = 6.38e6; printf("accelGravity: %lf\\", accelGravity); return 0;

1 Answer

7 votes

Answer:

See Explaination

Step-by-step explanation:

#include <stdio.h>

int main(void)

{

const double G = 6.673e-11;

const double M = 5.98e24;

double accelGravity = 0.0;

double distCenter = 0.0;

distCenter = 6.38e6;

//<StudentCode>

accelGravity = (G * M) / (distCenter * distCenter);

printf("accelGravity: %lf\\", accelGravity);

return 0;

}

User Shane Holloway
by
4.8k points