x=number of adults, y= number of students
x+y=12
18x+12y=162
You can simplify the second equation by dividing by six: 3x+2y=27
Rearrange the first equation: y= 12-x. Plug y into the simplified second equation:
3x+2(12-x)=27
3x-2x+24=27
x=3.
Plug the now known x value into y=12-x. So y= 9.
Therefore, there are 3 adults and 9 students.