Working of Capacitor and Resistor:
A resistor is a passive two-terminal electrical component that implements controlled amounts of resistance into electrical circuits meaning it restricts the amount of current flowing through a device. It doesn’t do anything actively to any electronic circuit; in fact, it’s simply hooked into a circuit to have the currents and voltages that you want precisely in your circuit. A capacitor, on the other hand, stores potential energy in an electric field and gives it back to the circuit when required. Simply put, it charges and discharges the electric charge stored in the circuit.