Since the variation is direct, then we have a function of the form:

From here, we must find the value of the constant k.
For this, we use the following data:
c = $ 54 when n is 9
Substituting values we have:

From here, we clear the value of k:

Therefore, the function is:

For n = 3 we have:
Answer:
the cost of the sandwiches when n is 3 is:
c = 18 $