From the question the gravitational force G between two bodies is inversely proportional to the square of the distance d between the bodies.
[tex]G\propto\frac{1}{d^2}[/tex]using the constant of proportionality k, we have;
[tex]\begin{gathered} G=\frac{k}{d^2} \\ k=Gd^2 \end{gathered}[/tex]Given;
[tex]\begin{gathered} d_1=12\operatorname{km} \\ G_1=40N \end{gathered}[/tex]Substituting this value to derive the value k;
[tex]\begin{gathered} k=Gd^2 \\ k=40(12)^2 \\ k=5760 \end{gathered}[/tex]So, for distance of 8 km, the gravitational force between the bodies is;
[tex]\begin{gathered} d_2=8\operatorname{km} \\ G_2=\frac{k}{d^2}=\frac{5760}{(8)^2} \\ G_2=90N \end{gathered}[/tex]Therefore, the gravitational force between the objects when they are 8 kilometers apart is 90N