As given by the question
There are given that the x varies directly as y.
That means,
As y increases, x will increase and y decreases, x will decrease.
Now,
From the formula:

Then,
Fromthe given question,
x is 30 when y is 6
So,

Now,
Find x when y is 9
So,

Hence, the value of x is 45.