So if 1/2 = 18 miles, we want to first find how many sets of 1/2 are in 21/2. We can just do this by dividing.
(21/2) / (1/2) = 21
So we know that there are 21 sets of 1/2 in 21/2, and since 1/2 and 18 are equal, we can say we know there are 21 sets of 18.
We can multiply to find this.
21 * 18 = 378
So two towns are 378 miles apart.