In this case heat is given by water and taken by ice
Heat available with water to cool from 30∘C to 0∘C
=msθ=5×1×30=150 cal
Heat required by 5 gm ice to increase its temperature up to 0∘C is
msθ=5×0.5×20=50 cal
Out of 150 cal heat available, 50 cal is used for increasing temperature of ice from −20∘C to 0∘C. The remaining heat 100 cal is used for melting the ice.
If mass of ice melted is m gm then
m×80=100⇒m=1.25 gm
Thus, 1.25 gm ice out of 5 gm melts and mixture of ice and water is at 0∘C.