let X = Actual speed
Effective speed downstream = X+2 : as speed of river is 2 km/hr ( I assume there is a correction in units)
Effective speed upstream = X-2
Let time taken for down stream = t1
and upstream = t2
t1 +t2 = 5 (time in hours) given
Speed = distance /time
X+2 = 24 /t1 Gives t1 = 24/(X+2) and t2 = 24/ (X-2)
These equations give 24/(X+2) + 24/(X-2) = 5
Which gives equation as 5X2 -48X -20=0
or 5X2 -50X +2X -20=0
Gives X = 10 km/hr and -2/5 km/hr . -2/5 km/hr can be ignored
Actual Speed =10km/hr