from a point on the egde of the sea,one ship is 24km away on a bearing,550east and another ship 7 km away on a bearing of S40 w.how far a part are the ships?

You have a typo in "550east"

Did you mean N 50 E ?

On that assumption I made a sketch and got a very
skiiny triangle with sides 24 and 7 and a contained angle of 170°.

So it is simply a cosine law situation.
x^2 = 24^2 + 7^2 - 2(24)(7)cos170°
x = ...

careful, cos 170 will be negative, so you will have - ( - ) at the end