In a resonance tube experiment, resonance occurs at two consecutive lengths \( l_1 \) and \( l_2 \) when the tube resonates at the first and second harmonics. The difference between these two lengths is half of the wavelength:
\[
l_2 - l_1 = \frac{\lambda}{2}
\]
Given that \( l_1 = 100 \, \text{cm} \) and \( l_2 = 140 \, \text{cm} \), we find:
\[
\lambda = 2 \times (140 - 100) = 80 \, \text{cm} = 0.8 \, \text{m}
\]
Now, we can calculate the velocity of sound using the formula:
\[
v = f \times \lambda
\]
Where:
- \( f = 400 \, \text{Hz} \) (frequency)
- \( \lambda = 0.8 \, \text{m} \) (wavelength)
Thus:
\[
v = 400 \times 0.8 = 320 \, \text{m/s}
\]
Therefore, the velocity of sound is \( 320 \, \text{m/s} \).