speed = distance/time
distance = speed * time
The return trip took 5 hours, so the time of the return trip is 5 hours.
The speed of the return trip is 20 km/h.
distance = speed * time = 20 km/h * 5 hours = 100 km
The distance is 100 km.
On the way to the friend's house, he traveled at 25 km/h.
time = distance/speed
time = (100 km)/(25 km/h) = 4 hours
It took him 4 hours to get to the friend's house, and it took him 5 hours to get back. The entire trip took 4 hours + 5 hours = 9 hours.
Answer: It took him