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

3x+40.5-4.5x=33

-1.5x+40.5=33

-1.5x=-7.5

x=5

Solve for y using (3): y=9-5

y=4

So, there were 5 3V batteries and 4 4.5V batteries.