Answer
$x^2+12x+35$
Work Step by Step
$\frac{x^2+13x+40}{x-7}\div\frac{x+8}{x^2-49}$
$\frac{x^2+13x+40}{x-7}*\frac{x^2-49}{x+8}$
$\frac{(x+5)(x+8)}{x-7}*\frac{(x+7)(x-7)}{x+8}$
$\frac{(x+5)(x+8)(x+7)(x-7)}{(x-7)(x+8)}$
$(x+5)(x+7)$
$x^2+12x+35$