q=mcDeltaT, in which q is the energy gained or lost, m is mass, c is specific heat capacity, and DeltaT is the change in temperature (final temperature - initial temperature). The following video from the website http://www.kentchemistry.com/links/Energy/SpecificHeat.htm
is very informative. Note that some people use Q instead of q and C instead of c.