The potential difference across the capacitor

V_{0} = Q/C = 20/5 = 4V

The initial current,

i_{0} = V/R = 4/5 = 0.8A

τ = CR = 20*5 = 100 µs

The current in the resistor at any time t

i = i_{0}e^{-t/τ}

The heat dissipated,

After substituting and simplifying, we get

**H = 4.7 µJ**