This can be solved using simple algebra.
Let's take the base as x
It's give that the height is the base - 5.
So, the height is (x - 5)
Now plug those in the formula for finding the area of the triangle and you get:
(x^2 - 5x)/2 = 42
x^2 - 5x = 84
x (x - 5) = 84
After solving the equation, you get x = 12 and x = -7. Since lengths can't be negative, we ignore the one with the negative value.
Since x was the base, the base = 12 and the height was x - 5 so 12 - 5 = 7
:D