Since the batteries are in series, the total amount of voltage 33V is the sum of the individual voltages of the batteries: 3x+4.5y=33
Solve for y using (1) to obtain (3): y=9-x
Substitute (3) to (2) and solve for x: 3x+4.5(9-x)=33
Solve for y using (3): y=9-5
So, there were 5 3V batteries and 4 4.5V batteries.