Solution:
Let the speeds of the cars be x km/hr and y km/hr
Case 1:
When the cars are going in the same direction
Relative speed = x - y
Distance = 100 km
Time = 100 / (x - y) = 5 hrs
x - y = 100 / 5=20
x – y = 20 ------------- (1)
Case 2:
When the cars are going in the opposite direction
Relative speed = x + y
Time =100 / (x + y) = 1 hrs
x + y = 100 ------------- (2)
Solving the equations (1) and (2),
x = 60
y = 40
Hence the speeds of the cars are 60 km/hr and 40 km/hr.