Answer to Question #225354 in C for MENSAH PAUL OSEI

Question #225354
Newton's law states that the force, F, between two bodies of masses My and M₂ is given by:

F = k(MM).

in which is the gravitational constant and d is the distance between the bodies. The value of k is approximately 6.67x10" dyn, cn/g Write a program that prompts the user to input the masses of the bodies and the distance between the bodies. The program then outputs the force between the bodies.
1
Expert's answer
2021-08-11T14:12:09-0400
#include<stdio.h>
int main(){
	float first, second, distance;
	printf("Enter the mass of the first body\n");
	scanf("%f",&first);
	printf("Enter the mass of the second body\n");
	scanf("%f",&second);
	printf("Enter the distance between the two bodies\n");
	scanf("%f",&distance);
	float force = (6.67* 10 * second * first ) / distance * distance;
	printf("The force is:  %f", 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