From the question the gravitational force G between two bodies is inversely proportional to the square of the distance d between the bodies.

using the constant of proportionality k, we have;

Given;
![\begin{gathered} d_1=12\operatorname{km} \\ G_1=40N \end{gathered}]()
Substituting this value to derive the value k;

So, for distance of 8 km, the gravitational force between the bodies is;
![\begin{gathered} d_2=8\operatorname{km} \\ G_2=(k)/(d^2)=(5760)/((8)^2) \\ G_2=90N \end{gathered}]()
Therefore, the gravitational force between the objects when they are 8 kilometers apart is 90N