======================================================
Work Shown:
x = total bill amount ignoring the tip
18% of x = 0.18x = tip amount
x+0.18x = 1.18x = amount Martin paid = 27
1.18x = 27
x = 27/1.18
x = 22.8813559322033 approximately
x = 22.88 dollars was the total bill.
----------
Checking the answer:
18% of 22.88 = 0.18*22.88 = 4.1184 = 4.12
Martin left a tip of $4.12
Add this on top of the bill to get 22.88+4.12 = 27
This matches with the fact he paid $27.
The answer is confirmed.