A cork floats in water while the iron nail sinks because the density of cork is less than that of water. Thus, the upthrust of water on the cork is greater than the weight of the cork. Hence, it floats. On the other hand, the density of iron nail is more than water, and the upthrust of water on iron nail is less than that of the weight of the iron nail. Thus, it sinks.