The two forces acting on a body immersed in a liquid are:
(i) upward buoyant force F.
(ii) weight of the body acting vertically downwards W.
When the body floats
weight of the body = upward buoyant force
For a body to float, the density of the body should be less than the density of the liquid. In that case, the weight of the liquid displaced will be equal to more than the weight of the body. For a body to sink, the density of the body should be more than the density of the liquid. The body now experiences a net downward force and sinks to the bottom.