Let T be the final temperature of water and nails (iron).
Given that the initial temperature of 100 g nails,
.
Specific heat of the iron,
.
So, the heat lost by nails


The initial temperature of 100 g water,

Specific heat of water,

So, the heat gained by water


As the exergy is conserved, so
the heat lost by the nails = the heat gained by the water
From equation (i) and (ii), we have






Hence, the final temperature of both, iron nails as well as water, become
.