what would be the final temperature when 80kg of 0 degrees C cold water is mixed with 60kg of 40 degrees C warm water.

The sum of the heats gained is zero (one of them loses heat, or negative heat gained).

Heatgained80 + heatgained60=0
80*c*(Tf-0) + 60*c*(Tf-40)=0
solve for Tf.