Hello, Sohail!
Did you make a sketch?
A point $\displaystyle P$ is 12 km due north of another point $\displaystyle Q$.
The bearing of a lighthouse $\displaystyle R$ from $\displaystyle P$ is 135°, and from $\displaystyle Q$ it is 120°.
Calculate the distance $\displaystyle PR$. Code:

P * 135°
 *
45°*
r=12  *
 *
 *
Q * 120° *
* * q
* *
* *
* *
* *
* *
* *
*15°*
* *
* R
In $\displaystyle \Delta PQR$, we have: .$\displaystyle \angle P = 45^o,\;\angle Q = 120^o$, then $\displaystyle \angle R = 15^o$
. . also: .side $\displaystyle r = PQ = 12$ and we want side $\displaystyle q = PR.$
Law of Sines: .$\displaystyle \frac{q}{\sin Q} \,= \,\frac{r}{\sin R}\quad\Rightarrow\quad q \:=\:\frac{r\sin Q}{\sin R} $
Therefore, we have: .$\displaystyle q\:=\:PQ\:=\:\frac{12\cdot\sin120^o}{\sin15^o} \:\approx\:40.15$ km.