Required a mathematical solution of the problem

Hello Friend .............

Here is a problem stated as:

Let there is a milkman who requires 40 liter of milk a day. constraint is that he can have exactly 19 animals. and the animals he can choose are as below with their capability of giving milk.

Cow can give 2 liters a day.

Buffalo can give 5 liters a day. and

Goat can give (1/4) liter a day.

This problem's solution is:

No of Cows =12 milk produced = 12 * 2 = 24

No of Buffaloes = 3 milk produced = 5*3 = 15

No of Goats = 4 milk produced =(1/4) * 4 = 1

**No of animals =19 milk produced =40 liters**

Now Problem is that is there __any system of liner equations__ that can be used to get answer of such type of problems, Trial and error methods is not needed.

Thank you all........