Integrating by parts, we have
∫π0x2cosx(1+sinx)2dx
=−x21+sinx∣∣∣π0+2∫π0x1+sinxdx=−π2+2I
where I=∫π0x1+sinxdx=∫0ππ−x1+sinxdx=π∫π0dx1+sinx−I
⇒2I=π∫π0dx1+sinx=2π∫π/20dx1+sinx
⇒I=π∫π/20dx1+sinx=π∫π/20dx1+sin(π/2−x)
=∫π/20dx1+cosx
=π2∫π/20sec2(x/2)dx=πtan(x/2)]π/20=π
Hence ∫π0x2cosx(1+sinx)2dx=−π2+2π
Therefore A=2