Capacitor stores the electrostatics energy. This energy is due to electric field between capacitor which is generated by voltage of ac power supply. For example in parallel plate capacitor, electrostatics energy is expressed as
where c is capacitance and is voltage.
Inductor stores electromagnetic energy. This energy is due to presence of magnetic field inside inductor which generates due to alternating current supply by the ac power source. For example in inductor, electromagnetic energy is expressed as
where is the inductance and I is the current.
Resistor when connected in circuit despites heat or power loss as per joule’s law of heating which is mathematically expressed as
where is the heat loss, is the resistance and t is time for which current is flowing.