Given,
Speed of the stream = 5 km/h
and speed of the man in still water = 20 km/h
∴ Speed of the man downstream = 20 + 5 = 25 km/h
and speed of the man upstream = 20 - 5 = 15 km/h
∴ Total time taken to complete the whole journey = 30/25 + 30/15
= (30 x 8) / 75
= 3 h 12 min