Let the speed of 1st car and 2nd car be u km/h and v km/h. (Assuming u > v)
Respective speed of both cars while they are travelling in same direction = (u - v) km/h
Respective speed of both cars while they are travelling in opposite directions i.e., travelling towards each other = (u + v) km/h
According to the question,
5(u - v) = 100
⇒ u - v = 20 ... (i)
1(u + v) = 100 ... (ii)
Adding both the equations, we get
2u = 120
u = 60 km/h ... (iii)
Putting this value in equation (ii), we obtain
v = 40 km/h
Hence, speed of one car is 60 km/h and speed of other car is 40 km/h.