Distance between places A and B is 100 km.
Speed of A car us ‘u’ km/hr.
Speed of B car is ‘v’ km/hr.
If the cars travel in the same direction at different speeds they meet in 5 hours about 20 km.
∴ u – v = 20 ………. (i)
If the cars travel in the same direction, total distance covered =100 km.
∴ u + v = 100 …….. (ii)
We can solve by Elimination method:
From eqn. (i) + eqn. (ii),

∴ u = 60 km/hr.
Substituting the value of ‘u’ in eqn. (ii),
u + v = 100
60 + v = 100
v = 100 – 60
v = 40 km/hr.
∴ u = 60 km/hr.
v = 40 km/hr.