According to first law of thermodynamics "Energy can neither be created nor be destroyed, it can only be converted from one form to another"
Mathematically ΔE or ΔU=q+W ΔU= change in internal energy q= heat absorbed W= work done
Heat absorbed by the system →q=+ ve
Heat given out by the system →q=− ve
Work done on the system →W=+ ve
Word done by the system W=− ve