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 Reply

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