Let the speed of one train be x km/hr.
Speed of other train be (x + 5) km/hr.
Total distance between two stations = 340 km
By using the formula
Distance = speed × time
So, Distance covered by one train in 2 hrs. Will be x×2 = 2x km
Distance covered by other train in 2 hrs. Will be 2(x + 5) = (2x + 10) km
Distance between the trains is 30 km
2x + 2x + 10 + 30 = 340
4x + 40 = 340
4x = 340 – 40
4x = 300
x = 300/4
= 75
∴ The speed of one train is x = 75 km/hr.
Speed of other train is (x + 5) = 75 + 5 = 80 km/hr.