Ravi bought x toys for 27$ and 3 mechanical pencils for x$.Given that the total cost of a toy and a mechanical pencil is 6$,write a quadratic equation in terms of x.

To write a quadratic equation in terms of x, let's break down the information given and translate it into the required equation.

1. Ravi bought x toys for $27:
The cost of each toy is $27/x.

2. Ravi bought 3 mechanical pencils for x$:
The cost of each mechanical pencil is x/3$.

3. The total cost of a toy and a mechanical pencil is $6:
The sum of the cost of a toy and a mechanical pencil is $6.

Based on this information, we can create an equation:

Cost of a toy + Cost of a mechanical pencil = $6
($27/x) + (x/3) = $6

To solve this equation, we need to clear the fractions by multiplying through by the LCD, which is 3x:
3(x)($27/x) + (x/3)(3x) = ($6)(3x)

Simplifying this equation gives us:
81 + x^2 = 18x

Finally, rearranging the equation and combining like terms, we get the quadratic equation in terms of x:
x^2 - 18x + 81 = 0