Archimedes’ principle states that, when an object is fully or partially immersed in a liquid, it experiences a buoyant force or upthrust, which is equal to the weight of liquid displaced by the object, i.e.Buoyant force or upthrust acting on an object= Weight of liquid displaced by the object.
A cork floats in the water whereas an iron nail sinks because the density of cork is less than the density of water. This means that the upthrust of water on the cork is greater than the weight of the cork. So, it floats. However, the density of an iron nail is more than the density of water. This means that the upthrust of water on the iron nail is less than the weight of the nail. So, it sinks.