heat of fusion in an equation
If you go by thermodynamic conventions,

$$\begin{align}q &gt; 0 &amp;\implies \text{ heat is gained by system}\\
q &lt; 0 &amp;\implies \text{ heat is lost by system} \end{align}$$


You initially considered water as your system, and it lost heat, therefore  $q$ was negative.
Now when you do calculation for ice, it becomes your system, and the heat is gained by ice, $\implies$ positive $q$