To solve this question, you need to incorporate stoichiometry. The first step is writing out the whole balanced reaction. Given #KNO_3#, #S_8#, and #C#, the reaction will be:

#16KNO_3(s) + 24C(s) + S_8(s) rarr 24CO_2(g) + 8N_2(g) +8K_2S(s)#

Setting this equation up is annoying, but when you realize that the other product is #K_2S# because #K and S# are the only reactants not in the products given, and they occur in a #1:2# ratio due to their oxidation states, balancing becomes a little easier.

The definition of #P-V# work is #w_(PV)= -P_(external)DeltaVolume#.

Note: #Delta(Volume) = (V_(FINAL) - V_(INITIAL)) or (V_f - V_i)#

External pressure is given as #1.00 atm# so the work only depends on the change of volume.

Since the reactants are all solids, none of the reactants contribute to the volume. Hence, #V_i = 0#.

To find the volume of the products, you need to use the reaction to find the amount of moles of the product made from #3.45g KNO_3#.

Convert #KNO_3# into moles using its molar mass of #101.102g#.

(#KNO_3# is the limiting reactant because there is "sufficient" (i.e. excess) sulfur and carbon.)

#3.45gKNO_3 * (1mol KNO_3)/(101.102g)= .0341 mol KNO_3#

Now convert moles #KNO_3# into moles #CO_2# and #N_2# using the stoichiometric ratios from the balanced equation.

#.0341 mol KNO_3 * (24 mol CO_2)/(16 mol KNO_3) = .05115 mol
CO_2#

#.0341 mol KNO_3 * (8 mol N_2)/(16 mol KNO_3) = .01705 mol N_2#

#K_2S# doesn't factor into the volume because it is a solid, so you don't need to include it into the volume calculation.

Now convert the moles into grams using molar masses.

#.05115 mol CO_2 * (44.01g)/(1 mol CO_2) = 2.251 g CO_2#

#.01705 mol N_2 * (28.014g)/(1 mol N_2) = .478 g N_2#

Now convert grams into volume using the density values given.

#2.251 g CO_2 * (1 L)/(1.830 g) = 1.230 L of CO_2#

#.478 g N_2 * (1 L)/(1.165g) = .410 L of N_2#

To find the final volume, just sum the two volumes.

#1.230L + .410L = 1.640L = V_f#

Now plug everything into the #w_(PV)# equation.

#w_(PV)= -1atm(1.640L- 0L) = -1.640 L*atm#

For the last step, convert #L*atm# into joules using the conversion #1L*atm= 101.325 J#

#-1.640L*atm *(101.325J)/(1L*atm)= -166.173J#