.
Let C be the number of cows and H be the number of horses.
From the condition, you have this system of 2 equations in 2 unknowns
C = 3H, (1)
C + H = 112. (2)
Solve it by the substitution method.
From equation (1), you just have an expression for C. Substitute it into equation (2), replacing C:
3H + H = 112,
4H = 112
H = 112/4 = 28.
Answer. 28 horses and 3*28 = 84 cows.