Since the mass and weight vary directly, they are linked by an expression like
[tex] w = km [/tex]
where w is the weight, m is the mass and k is the constant which gives the proportion.
Approach 1:
We may deduce the value of k from the first example: if 5kg weight 20N, then
[tex] 20 = 5k \implies k = \frac{20}{5} = 4 [/tex]
And once k is known, solve the second example for m:
[tex] 32 = 4m \implies m = \frac{32}{4} = 8[/tex]
Approach 2:
Since the two quantity vary directly, they are in proportion. So, we can write a proportion like
mass1 : weight1 = mass2 : weight2
and solve it for mass2:
[tex] 5 : 20 = m : 32 \implies m = \frac{5\cdot 32}{20} = \frac{32}{4} = 8 [/tex]
Of course, both approaches give the same result.