Let the speed of boat upstream be x and downstream be y.

acc to the question;

since

speed=distance/time

therefore;

time =distance/speed

12/x+40/y=8hrs.

=12y+40x=8xy----(i)(taking L.C/M and then shifting the denominator to R.H.S)

If it can go 16 km upstream and 32 km downstream in the same time;

therefore;

16/x+32/y=8hrs

=16y+32x=8xy---(ii)(taking L.C/M and then shifting the denominator to R.H.S)

therefore (i)=(ii)

i.e.,

12y+40x=16y+32x

40x-32x=16y-12y

8x=4y

y=2x

substituting y=2x in eqn (ii)

16(2x)+32x=8(x)(2x)

64x=16x²

64=16x

x=64/16

x=4

therefore ;

from eqn(ii)

16y+32(4)=8(4)y

16y+128=32y

128=32y-16y

16y=128

y=8

hope i helped u:)