Step 1: Use the formula for average velocity.
The average velocity is given by the formula:
\[
\text{Average velocity} = \frac{\text{Total distance}}{\text{Total time}}
\]
Step 2: Calculate the total distance.
Let the total distance be \( D \). The body travels half the distance with velocity \( 20 \, \text{km/hr} \) and the other half with velocity \( 30 \, \text{km/hr} \).
Step 3: Calculate the time taken for each half.
For the first half of the distance, the time taken is:
\[
t_1 = \frac{\frac{D}{2}}{20} = \frac{D}{40}
\]
For the second half of the distance, the time taken is:
\[
t_2 = \frac{\frac{D}{2}}{30} = \frac{D}{60}
\]
Step 4: Calculate the total time.
The total time is the sum of \( t_1 \) and \( t_2 \):
\[
\text{Total time} = t_1 + t_2 = \frac{D}{40} + \frac{D}{60}
\]
\[
\text{Total time} = \frac{3D}{120} + \frac{2D}{120} = \frac{5D}{120} = \frac{D}{24}
\]
Step 5: Calculate the average velocity.
Now, use the formula for average velocity:
\[
\text{Average velocity} = \frac{D}{\frac{D}{24}} = 24 \, \text{km/hr}
\]
Thus, the average velocity is:
\[
\boxed{24 \, \text{km/hr}}
\]