Let the speed of the car A and B be x km/h and y km/h respectively. Let x > y.
Case-1: When they travel in the same direction
From the figure
AC – BC = 160
⇒ x × 8 – y × 8 = 160
⇒ x – y = 20
Case-2: When they travel in opposite direction
From the figure
AC + BC = 160
⇒ x × 2 + y × 2 = 160
⇒ x + y = 80
Adding (i) and (ii), we get
2x = 100
⇒ x = 50 km/h
Putting x = 50 in (ii), we have
50 + y = 80
⇒ y = 80 – 50 = 30 km/h
Hence, the speeds of the cars are 50 km/h and 30 km/h.