The workings.

There are 18 animals in a pet store.
Some are birds and some are dogs.
There are 50 legs in all.
How many birds and how many dogs are there?

Say we set dog as x and bird as y. From the question we get:

x + y = 18          (Eq. 1)

4x + 2y = 50    (Eq. 2)

Use these to find the value of x and y.

From Eq. 1 we get :  x = 18 – y

Insert this into Eq. 2 :  4(18-y) + 2y = 50

Calculating that, we get :

72 – 4y + 2y = 50

2y = 22

y = 11

So, we have 11 birds. Let’s use this value into Eq. 1, and we get:

x + 11 = 18

x = 7

So, we have 7 dogs.

Sorted!