%PROGRAM TO CALCULATE ENERGY STORED IN (1)INDIVIDUAL CAPACITANCE %(2)CAPACITANCES CONNECTED IN SERIES %(3) CAPACITANCES CONECTED IN PARALLEL C1 = input('Enter the value of first capacitor in Farads = '); C2 = input('Enter the value of second capacitor in Farads = '); V = input('Enter the value potential applied across capacitors in volts = '); %Calculate the energy stored in first capacitor disp('Energy stored in C1 = '); W1 = (1/2)*C1*(V^2) %Calculate the energy stored in second capacitor disp('Energy stored in C2 = '); W2 = (1/2)*C2*(V^2); %Calculate Equivalent capacitance - Capacitors connected in series Ceq_Series = (C1*C2)/(C1+C2); %Calculate Equivalent capacitance - Capacitor connected in Parallel Ceq_Parallel = C1+C2; %Calculate the energy stored in equivalent capacitance (both series & %parallel) disp('Total Energy stored when capacitors are connected in Series = '); W_series = (1/2)*Ceq_Series*(V^2); disp('Total Energy stored when capacitors are connected in Parallel ='); W_Parallel = (1/2)*Ceq_Parallel*(V^2);