Concept:
The potential energy of a magnetic dipole in a uniform magnetic field is
\[
U=-MB\cos\theta
\]
where
\[
M=\text{magnetic moment}
\]
\[
B=\text{magnetic field}
\]
\[
\theta=\text{angle between } \vec M \text{ and } \vec B
\]
The work done in rotating the dipole is equal to the increase in potential energy.
Step 1: Calculate the initial potential energy.
Initially the magnet is along the magnetic field.
Hence,
\[
\theta_1=0^\circ
\]
\[
U_1=-MB\cos0^\circ
\]
\[
U_1=-MB
\]
Step 2: Calculate the final potential energy.
Finally the magnet becomes perpendicular to the field.
\[
\theta_2=90^\circ
\]
\[
U_2=-MB\cos90^\circ
\]
\[
U_2=0
\]
Step 3: Find the work done.
\[
W=U_2-U_1
\]
\[
W=0-(-MB)
\]
\[
W=MB
\]
Substituting,
\[
M=1.5\,A\,m^2
\]
\[
B=18\times10^{-2}\,T
\]
\[
W=1.5\times18\times10^{-2}
\]
\[
W=27\times10^{-2}
\]
\[
W=0.27J
\]
Step 4: Convert into millijoules.
\[
0.27J=270mJ
\]
\[
\boxed{270mJ}
\]