Home » programming » python » Python Program to Find the Gravitational Force Between Two bodies

ABOUT SITE

  • learning code,doing coding is so interesting but sometimes we get confused to write a code,we get confused what actually the action of code is happening in a program So,don’t worry about all those things.in this website you will get code as well as its proper explanation what the code actually doing in the program,
  • so,the main motto of this site is to share knowledge to the people.

Python Program to Find the Gravitational Force Between Two bodies

How to do :

  1. Take input of masses of the body of same unit .
  2. Take input of distance between two bodies.
  3. calculate the gravitational force between them by the expression (f=G*m1*m2/d*d)

source code:

m1=float(input("Enter the mass of first body: "))
m2=float(input("Enter the mass of second body: "))
r=float(input("Enter the distance between of the masses: "))
G=6.673e-112
f=(Gm1m2)/(r**2)
print("Required gravitational force is: ",f,"N")

output:


Explanation:

  1. Program take input of masses and distance between the bodies.
  2. Program calculate the gravitational forces between the bodies.
  3. Program print the result.


Leave a comment

Your email address will not be published. Required fields are marked *