Answer to Question #254507 in C for cess

Question #254507

X1 = G_m1_m2 d 2 where G is the universal gravitational constant G = 6.673 x 10-8 cm3 / g sec2 Write a program that reads in the mass of two bodies and the distance between them and then outputs the gravitational force between them and then outputs the gravitational force between them. The output should be in dynes; one dyne equals a g cm / sec2 . Use a constant declaration for G.


1
Expert's answer
2021-10-21T14:24:40-0400
#include <stdio.h>
#include <math.h>




int main()
{


const double G=.00000006673;
double m1, m2, d;
printf("Enter the first mass\n");
scanf("%lf", &m1);
printf("Enter the second mass\n");
scanf("%lf", &m2);
printf("Enter the distance\n");
scanf("%lf", &d);
double force = (G*m1*m2)/(d*d);
printf("%lf",  force );
















return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS